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

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

l = A("l")
a = B("a")
e = A("e")

l.s = a
a.o = e
a.v = l
e.s = a
assert e.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

l = A("l")
a = B("a")
e = A("e")

l.s = a
a.o = e
a.v = l
e.s = a
assert e.s.v.s.txt == "a"