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

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

b = A("b")
l = B("l")
m = B("m")
k = A("k")

b.u = l
l.o = m
m.o = l
k.u = l
assert k.u.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

b = A("b")
l = B("l")
m = B("m")
k = A("k")

b.u = l
l.o = m
m.o = l
k.u = l
assert k.u.o.o.txt == "l"