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

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

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

e = A("e")
l = B("l")
c = C("c")
m = C("m")
a = A("a")
b = A("b")

e.u = a
l.x = e
l.t = c
c.u = m
c.z = m
m.u = c
m.z = c
a.u = b
b.u = a
assert m.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

e = A("e")
l = B("l")
c = C("c")
m = C("m")
a = A("a")
b = A("b")

e.u = a
l.x = e
l.t = c
c.u = m
c.z = m
m.u = c
m.z = c
a.u = b
b.u = a
assert m.z.z.z.z.z.z.txt == "m"