class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: B = None
        self.s: A = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.t: D = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.z: D = None
        self.p: D = None
        self.txt = txt

n = A("n")
a = B("a")
k = C("k")
l = D("l")
m = B("m")
g = C("g")
b = A("b")
j = D("j")
f = B("f")

n.u = m
n.r = m
n.w = m
n.s = b
a.z = n
k.x = n
k.r = l
k.t = l
k.p = a
l.v = g
l.y = g
l.z = j
l.p = j
m.z = b
g.x = b
g.r = l
g.t = j
g.p = a
b.u = a
b.r = f
b.s = n
b.w = m
j.v = g
j.y = g
j.z = l
j.p = l
f.z = b
assert b.s.s.u.z.s.s.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: B = None
        self.s: A = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.t: D = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.z: D = None
        self.p: D = None
        self.txt = txt

n = A("n")
a = B("a")
k = C("k")
l = D("l")
m = B("m")
g = C("g")
b = A("b")
j = D("j")
f = B("f")

n.u = m
n.r = m
n.w = m
n.s = b
a.z = n
k.x = n
k.r = l
k.t = l
k.p = a
l.v = g
l.y = g
l.z = j
l.p = j
m.z = b
g.x = b
g.r = l
g.t = j
g.p = a
b.u = a
b.r = f
b.s = n
b.w = m
j.v = g
j.y = g
j.z = l
j.p = l
f.z = b
assert b.s.s.u.z.s.s.r.z.txt == "b"