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

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

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

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

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

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

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

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

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

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

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