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

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

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

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

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

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

j.p = l
j.v = l
e.o = l
l.p = j
l.v = j
assert e.o.p.p.txt == "l"