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.u: B = None
        self.txt = txt

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

n = A("n")
h = B("h")
k = C("k")
a = A("a")
d = B("d")
f = C("f")
b = A("b")
j = A("j")
e = B("e")

n.z = a
n.u = b
h.u = e
k.z = f
a.z = n
a.u = b
d.u = e
f.z = k
b.z = a
b.u = a
j.z = b
j.u = n
e.u = h
assert e.u.u.u.u.u.u.u.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.u: B = None
        self.txt = txt

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

n = A("n")
h = B("h")
k = C("k")
a = A("a")
d = B("d")
f = C("f")
b = A("b")
j = A("j")
e = B("e")

n.z = a
n.u = b
h.u = e
k.z = f
a.z = n
a.u = b
d.u = e
f.z = k
b.z = a
b.u = a
j.z = b
j.u = n
e.u = h
assert e.u.u.u.u.u.u.u.u.u.txt == "h"