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

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

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

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

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

i.o = a
i.z = a
i.u = l
i.y = j
c.u = m
c.r = m
m.q = c
l.p = a
l.x = a
l.t = m
l.z = g
g.o = j
g.z = j
g.u = k
g.y = i
k.p = i
k.x = j
k.t = e
k.z = g
a.o = g
a.z = i
a.u = k
a.y = j
j.o = g
j.y = g
j.z = i
j.u = l
e.q = c
assert m.q.r.q.r.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.u: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

i.o = a
i.z = a
i.u = l
i.y = j
c.u = m
c.r = m
m.q = c
l.p = a
l.x = a
l.t = m
l.z = g
g.o = j
g.z = j
g.u = k
g.y = i
k.p = i
k.x = j
k.t = e
k.z = g
a.o = g
a.z = i
a.u = k
a.y = j
j.o = g
j.y = g
j.z = i
j.u = l
e.q = c
assert m.q.r.q.r.q.u.txt == "m"