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

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

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

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

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

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

e.t = m
m.w = i
i.w = l
n.t = a
l.w = a
a.w = i
assert a.w.w.w.txt == "a"