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

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

i = A("i")
n = B("n")
l = B("l")

i.s = n
n.u = l
l.u = n
assert i.s.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

i = A("i")
n = B("n")
l = B("l")

i.s = n
n.u = l
l.u = n
assert i.s.u.u.txt == "n"