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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: A = None
        self.p: D = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

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

i.o = g
i.u = j
g.z = f
g.u = d
g.s = k
k.p = f
a.z = m
f.q = a
f.t = n
f.p = m
f.x = i
f.v = i
m.z = a
n.o = g
n.u = i
j.o = g
j.u = i
d.z = f
d.u = g
d.s = k
c.p = f
assert c.p.p.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: A = None
        self.p: D = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

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

i.o = g
i.u = j
g.z = f
g.u = d
g.s = k
k.p = f
a.z = m
f.q = a
f.t = n
f.p = m
f.x = i
f.v = i
m.z = a
n.o = g
n.u = i
j.o = g
j.u = i
d.z = f
d.u = g
d.s = k
c.p = f
assert c.p.p.z.z.z.z.txt == "m"