class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: E = 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.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.x: C = None
        self.t: C = None
        self.y: A = None
        self.txt = txt

e = A("e")
d = B("d")
g = C("g")
f = D("f")
m = E("m")
k = D("k")
c = D("c")
h = C("h")
a = C("a")

e.z = h
e.x = m
d.q = a
g.u = d
f.o = e
m.s = a
m.t = a
m.r = e
m.y = e
m.x = g
k.o = e
c.o = e
h.u = d
a.u = d
assert c.o.z.u.q.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: E = 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.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.x: C = None
        self.t: C = None
        self.y: A = None
        self.txt = txt

e = A("e")
d = B("d")
g = C("g")
f = D("f")
m = E("m")
k = D("k")
c = D("c")
h = C("h")
a = C("a")

e.z = h
e.x = m
d.q = a
g.u = d
f.o = e
m.s = a
m.t = a
m.r = e
m.y = e
m.x = g
k.o = e
c.o = e
h.u = d
a.u = d
assert c.o.z.u.q.u.q.u.txt == "d"