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

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

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

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

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

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

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

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

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