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

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

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

l = A("l")
a = B("a")
e = C("e")
k = A("k")
b = B("b")

l.u = k
a.y = b
a.z = b
e.q = l
k.u = l
b.y = a
b.z = a
assert e.q.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

l = A("l")
a = B("a")
e = C("e")
k = A("k")
b = B("b")

l.u = k
a.y = b
a.z = b
e.q = l
k.u = l
b.y = a
b.z = a
assert e.q.u.u.u.u.txt == "l"