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

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

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

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

l.q = a
l.z = e
e.o = a
a.t = e
a.z = l
assert a.z.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.txt = txt

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

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

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

l.q = a
l.z = e
e.o = a
a.t = e
a.z = l
assert a.z.z.o.txt == "a"