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

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

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

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

j = A("j")
d = B("d")
i = C("i")
k = D("k")
e = B("e")
a = A("a")
b = B("b")
h = D("h")
l = C("l")
n = C("n")

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

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

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

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

j = A("j")
d = B("d")
i = C("i")
k = D("k")
e = B("e")
a = A("a")
b = B("b")
h = D("h")
l = C("l")
n = C("n")

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