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

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

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

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

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

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

c.o = n
c.x = n
n.v = l
l.o = n
l.x = n
assert l.o.v.x.txt == "n"