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

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

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

b = A("b")
d = B("d")
k = C("k")
f = C("f")
l = C("l")

b.x = k
b.o = f
d.x = b
d.t = b
d.s = k
k.w = d
f.w = d
l.w = d
assert b.x.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
k = C("k")
f = C("f")
l = C("l")

b.x = k
b.o = f
d.x = b
d.t = b
d.s = k
k.w = d
f.w = d
l.w = d
assert b.x.w.s.txt == "k"