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

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

c = A("c")
b = B("b")
j = B("j")
n = B("n")
e = A("e")

c.s = e
b.u = c
j.u = c
n.u = e
e.s = c
assert b.u.s.s.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.u: A = None
        self.txt = txt

c = A("c")
b = B("b")
j = B("j")
n = B("n")
e = A("e")

c.s = e
b.u = c
j.u = c
n.u = e
e.s = c
assert b.u.s.s.s.s.txt == "c"