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

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

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

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

k = A("k")
n = B("n")
f = C("f")
a = D("a")
e = A("e")
c = D("c")
g = C("g")
m = C("m")

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

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

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

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

k = A("k")
n = B("n")
f = C("f")
a = D("a")
e = A("e")
c = D("c")
g = C("g")
m = C("m")

k.v = a
k.q = n
k.z = f
k.p = e
n.p = g
n.s = k
n.t = f
f.p = e
f.z = e
f.w = m
f.y = n
a.y = n
a.x = k
e.v = c
e.q = n
e.z = m
e.p = k
c.y = n
c.x = k
g.p = k
g.z = e
g.w = m
g.y = n
m.p = k
m.z = k
m.w = f
m.y = n
assert m.y.t.y.t.p.p.p.v.txt == "c"