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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: E = None
        self.t: E = None
        self.q: B = None
        self.u: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.q: B = None
        self.u: B = None
        self.txt = txt

m = A("m")
n = B("n")
l = C("l")
h = D("h")
a = E("a")
k = A("k")
i = E("i")

m.y = l
m.q = n
n.o = i
l.z = m
l.w = a
l.t = a
l.q = n
l.u = h
h.o = l
h.z = l
a.t = h
a.r = l
a.q = n
a.u = n
k.y = l
k.q = n
i.t = h
i.r = l
i.q = n
i.u = n
assert n.o.t.z.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: E = None
        self.t: E = None
        self.q: B = None
        self.u: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.q: B = None
        self.u: B = None
        self.txt = txt

m = A("m")
n = B("n")
l = C("l")
h = D("h")
a = E("a")
k = A("k")
i = E("i")

m.y = l
m.q = n
n.o = i
l.z = m
l.w = a
l.t = a
l.q = n
l.u = h
h.o = l
h.z = l
a.t = h
a.r = l
a.q = n
a.u = n
k.y = l
k.q = n
i.t = h
i.r = l
i.q = n
i.u = n
assert n.o.t.z.w.r.txt == "l"