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

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

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

l = A("l")
i = B("i")
j = C("j")
b = C("b")

l.t = i
l.o = j
i.z = l
j.v = l
j.s = l
j.u = i
b.v = l
b.s = l
b.u = i
assert j.s.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

l = A("l")
i = B("i")
j = C("j")
b = C("b")

l.t = i
l.o = j
i.z = l
j.v = l
j.s = l
j.u = i
b.v = l
b.s = l
b.u = i
assert j.s.t.z.txt == "l"