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

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

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

g = A("g")
e = B("e")
a = C("a")
l = C("l")
i = C("i")
k = C("k")
j = C("j")
h = C("h")
m = A("m")
c = C("c")

g.q = e
e.r = m
a.t = c
a.z = e
l.t = h
l.z = e
i.t = j
i.z = e
k.t = l
k.z = e
j.t = k
j.z = e
h.t = j
h.z = e
m.q = e
c.t = a
c.z = e
assert a.t.z.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
a = C("a")
l = C("l")
i = C("i")
k = C("k")
j = C("j")
h = C("h")
m = A("m")
c = C("c")

g.q = e
e.r = m
a.t = c
a.z = e
l.t = h
l.z = e
i.t = j
i.z = e
k.t = l
k.z = e
j.t = k
j.z = e
h.t = j
h.z = e
m.q = e
c.t = a
c.z = e
assert a.t.z.r.q.txt == "e"