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

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

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

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

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

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

e.w = j
e.u = i
m.t = k
a.t = m
j.w = g
j.u = m
d.w = n
d.u = i
l.w = j
l.u = i
k.t = i
i.t = k
g.w = j
g.u = k
n.w = g
n.u = m
assert m.t.t.t.t.t.t.t.t.t.txt == "k"