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

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

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

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

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

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

c.o = l
i.s = c
i.u = l
l.s = c
l.u = i
assert l.s.o.s.txt == "c"