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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: A = None
        self.s: A = None
        self.txt = txt

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

i = A("i")
n = B("n")
k = C("k")
j = D("j")
c = E("c")
l = C("l")
d = D("d")
g = E("g")
e = D("e")
m = E("m")

i.w = n
n.t = i
n.r = i
n.z = i
n.s = l
k.z = e
j.r = l
j.p = i
j.s = i
c.o = d
c.q = j
l.z = d
d.r = k
d.p = i
d.s = i
g.o = j
g.q = j
e.r = k
e.p = i
e.s = i
m.o = e
m.q = d
assert l.z.r.z.r.z.s.w.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: A = None
        self.s: A = None
        self.txt = txt

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

i = A("i")
n = B("n")
k = C("k")
j = D("j")
c = E("c")
l = C("l")
d = D("d")
g = E("g")
e = D("e")
m = E("m")

i.w = n
n.t = i
n.r = i
n.z = i
n.s = l
k.z = e
j.r = l
j.p = i
j.s = i
c.o = d
c.q = j
l.z = d
d.r = k
d.p = i
d.s = i
g.o = j
g.q = j
e.r = k
e.p = i
e.s = i
m.o = e
m.q = d
assert l.z.r.z.r.z.s.w.s.z.txt == "d"