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

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

b = A("b")
c = B("c")
l = A("l")

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

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

b = A("b")
c = B("c")
l = A("l")

b.w = c
b.p = c
c.v = b
c.o = b
l.w = c
l.p = c
assert c.v.p.v.txt == "b"