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

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

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

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

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

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

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

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

d.u = l
l.x = h
a.t = h
h.u = l
e.t = d
b.x = d
g.t = h
k.t = d
m.u = l
assert e.t.u.x.u.x.u.txt == "l"