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

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

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

i = A("i")
b = B("b")
k = C("k")
d = C("d")
m = C("m")
g = A("g")
e = A("e")
a = B("a")

i.t = a
i.u = e
i.z = m
b.u = a
k.r = b
k.o = b
d.r = a
d.o = a
m.r = b
m.o = a
g.t = b
g.u = e
g.z = d
e.t = b
e.u = g
e.z = m
a.u = b
assert e.z.r.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: A = None
        self.z: C = None
        self.txt = txt

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

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

i = A("i")
b = B("b")
k = C("k")
d = C("d")
m = C("m")
g = A("g")
e = A("e")
a = B("a")

i.t = a
i.u = e
i.z = m
b.u = a
k.r = b
k.o = b
d.r = a
d.o = a
m.r = b
m.o = a
g.t = b
g.u = e
g.z = d
e.t = b
e.u = g
e.z = m
a.u = b
assert e.z.r.u.u.txt == "b"