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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

a = A("a")
f = B("f")
e = C("e")
c = D("c")
b = E("b")
n = B("n")
g = D("g")
l = C("l")
k = D("k")
d = E("d")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

a = A("a")
f = B("f")
e = C("e")
c = D("c")
b = E("b")
n = B("n")
g = D("g")
l = C("l")
k = D("k")
d = E("d")

a.z = n
f.s = a
e.y = g
e.q = l
c.p = e
c.x = e
c.r = l
c.t = l
b.w = a
b.p = f
b.x = d
n.s = a
g.p = e
g.r = e
g.x = l
g.t = l
l.y = c
l.q = e
k.p = l
k.t = l
k.r = e
k.x = e
d.w = a
d.p = n
d.x = b
assert a.z.s.z.s.z.s.txt == "a"