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

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

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

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

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

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

e.s = h
e.u = h
n.s = m
b.s = e
i.s = h
i.u = h
h.s = m
h.u = m
a.s = i
l.s = m
g.s = i
m.s = e
m.u = e
assert a.s.s.s.u.s.s.s.u.s.txt == "m"