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

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

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

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

j.w = i
j.q = i
i.t = c
c.o = i
b.w = i
b.q = i
l.w = i
l.q = i
assert i.t.o.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: B = None
        self.txt = txt

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

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

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

j.w = i
j.q = i
i.t = c
c.o = i
b.w = i
b.q = i
l.w = i
l.q = i
assert i.t.o.t.o.t.txt == "c"