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

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

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

m = A("m")
k = B("k")
l = C("l")

m.o = k
m.z = l
k.w = l
l.s = m
l.o = m
l.w = k
assert m.z.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: C = None
        self.txt = txt

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

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

m = A("m")
k = B("k")
l = C("l")

m.o = k
m.z = l
k.w = l
l.s = m
l.o = m
l.w = k
assert m.z.w.w.txt == "l"