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

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

l = A("l")
i = B("i")
j = A("j")
m = A("m")
a = A("a")
e = A("e")
n = A("n")

l.u = j
i.s = l
j.u = n
m.u = a
a.u = e
e.u = a
n.u = l
assert e.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

l = A("l")
i = B("i")
j = A("j")
m = A("m")
a = A("a")
e = A("e")
n = A("n")

l.u = j
i.s = l
j.u = n
m.u = a
a.u = e
e.u = a
n.u = l
assert e.u.u.u.u.txt == "e"