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

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

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

j = A("j")
l = B("l")
m = C("m")
c = C("c")
b = B("b")

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

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

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

j = A("j")
l = B("l")
m = C("m")
c = C("c")
b = B("b")

j.t = m
l.w = j
l.o = m
l.u = b
m.o = l
m.x = b
m.z = c
c.o = l
c.x = l
c.z = m
b.w = j
b.o = m
b.u = l
assert c.x.o.o.txt == "l"