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

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

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

e = A("e")
n = B("n")
f = C("f")
b = B("b")
d = A("d")
l = C("l")
h = C("h")
m = C("m")
i = B("i")

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

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

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

e = A("e")
n = B("n")
f = C("f")
b = B("b")
d = A("d")
l = C("l")
h = C("h")
m = C("m")
i = B("i")

e.u = d
e.z = n
n.y = e
f.z = i
b.y = e
d.u = e
d.z = i
l.z = i
h.z = i
m.z = n
i.y = d
assert n.y.u.u.u.z.y.z.y.txt == "d"