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

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

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

k = A("k")
a = B("a")
e = C("e")
h = C("h")
m = C("m")
d = C("d")
l = A("l")

k.o = a
a.t = d
a.u = d
e.z = a
e.v = m
h.z = a
h.v = m
m.z = a
m.v = h
d.z = a
d.v = m
l.o = a
assert m.z.t.z.t.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
e = C("e")
h = C("h")
m = C("m")
d = C("d")
l = A("l")

k.o = a
a.t = d
a.u = d
e.z = a
e.v = m
h.z = a
h.v = m
m.z = a
m.v = h
d.z = a
d.v = m
l.o = a
assert m.z.t.z.t.z.u.txt == "d"