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

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

l = A("l")
c = B("c")
e = B("e")
j = A("j")

l.s = j
c.w = e
e.w = c
j.s = l
assert e.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

l = A("l")
c = B("c")
e = B("e")
j = A("j")

l.s = j
c.w = e
e.w = c
j.s = l
assert e.w.w.w.txt == "c"