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

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

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

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

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

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

e.z = n
d.u = a
n.u = e
m.u = a
h.z = b
l.u = c
c.z = i
a.z = n
i.u = h
b.u = a
assert i.u.z.u.z.u.z.u.z.u.txt == "e"