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

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

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

c.s = i
b.t = i
i.s = c
f.t = i
l.t = c
assert b.t.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

c.s = i
b.t = i
i.s = c
f.t = i
l.t = c
assert b.t.s.s.txt == "i"