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

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

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

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

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

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

j.v = k
k.o = a
a.o = k
assert k.o.o.o.txt == "a"