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

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

i = A("i")
a = B("a")
l = A("l")
j = B("j")

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

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

i = A("i")
a = B("a")
l = A("l")
j = B("j")

i.v = j
a.p = i
l.v = a
j.p = l
assert i.v.p.v.txt == "a"