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

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

i = A("i")
k = B("k")
a = B("a")

i.o = a
k.u = a
k.v = i
a.u = k
a.v = i
assert i.o.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

i = A("i")
k = B("k")
a = B("a")

i.o = a
k.u = a
k.v = i
a.u = k
a.v = i
assert i.o.u.u.txt == "a"