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

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

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

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

l.s = b
l.p = e
l.o = e
b.o = l
b.w = l
e.v = l
e.w = l
e.r = b
assert l.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

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

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

l.s = b
l.p = e
l.o = e
b.o = l
b.w = l
e.v = l
e.w = l
e.r = b
assert l.s.w.s.txt == "b"