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

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

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

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

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

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

m.z = g
m.p = g
m.q = g
m.x = c
i.z = d
i.y = d
c.q = n
c.x = n
c.r = g
c.t = g
c.z = d
g.r = i
g.x = i
g.t = i
g.s = n
g.u = c
d.v = i
k.r = i
k.x = i
k.t = i
k.s = n
k.u = c
n.z = k
n.p = g
n.q = g
n.x = c
assert c.q.z.u.q.x.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: D = None
        self.q: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

m.z = g
m.p = g
m.q = g
m.x = c
i.z = d
i.y = d
c.q = n
c.x = n
c.r = g
c.t = g
c.z = d
g.r = i
g.x = i
g.t = i
g.s = n
g.u = c
d.v = i
k.r = i
k.x = i
k.t = i
k.s = n
k.u = c
n.z = k
n.p = g
n.q = g
n.x = c
assert c.q.z.u.q.x.z.v.txt == "i"