class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.r: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

k = A("k")
j = B("j")
m = C("m")
a = D("a")
c = A("c")
e = A("e")
b = C("b")
f = C("f")

k.s = f
k.z = a
k.r = j
k.q = b
j.q = f
m.z = e
m.w = f
m.y = f
m.u = j
a.t = j
c.s = m
c.q = m
c.z = a
c.r = j
e.s = f
e.z = a
e.r = j
e.q = m
b.z = e
b.w = m
b.y = m
b.u = j
f.z = e
f.w = m
f.y = m
f.u = j
assert b.z.r.q.u.q.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.r: B = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

k = A("k")
j = B("j")
m = C("m")
a = D("a")
c = A("c")
e = A("e")
b = C("b")
f = C("f")

k.s = f
k.z = a
k.r = j
k.q = b
j.q = f
m.z = e
m.w = f
m.y = f
m.u = j
a.t = j
c.s = m
c.q = m
c.z = a
c.r = j
e.s = f
e.z = a
e.r = j
e.q = m
b.z = e
b.w = m
b.y = m
b.u = j
f.z = e
f.w = m
f.y = m
f.u = j
assert b.z.r.q.u.q.u.q.u.txt == "j"