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

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

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

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

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

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

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

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

l.w = b
l.x = b
b.z = m
b.o = m
m.o = l
assert l.w.z.o.txt == "l"