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

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

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

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

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

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

e.t = i
i.s = e
l.s = e
assert l.s.t.s.txt == "e"