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

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

n = A("n")
h = B("h")
k = A("k")
i = B("i")
e = A("e")
d = A("d")
a = B("a")

n.z = e
n.u = e
h.y = i
h.o = d
k.z = d
k.u = e
i.y = a
i.o = k
e.z = k
e.u = n
d.z = n
d.u = k
a.y = i
a.o = k
assert a.o.z.z.z.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
h = B("h")
k = A("k")
i = B("i")
e = A("e")
d = A("d")
a = B("a")

n.z = e
n.u = e
h.y = i
h.o = d
k.z = d
k.u = e
i.y = a
i.o = k
e.z = k
e.u = n
d.z = n
d.u = k
a.y = i
a.o = k
assert a.o.z.z.z.u.u.txt == "e"