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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.o: E = None
        self.y: E = None
        self.p: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: E = None
        self.x: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.o: E = None
        self.y: E = None
        self.p: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: E = None
        self.x: C = None
        self.txt = txt

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

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

n.p = i
n.s = i
n.z = i
n.t = i
n.o = c
c.v = m
c.t = i
c.o = g
c.y = g
c.p = n
m.u = c
m.r = c
m.w = n
m.p = n
m.t = i
i.s = m
i.x = m
i.o = g
g.v = m
assert g.v.t.o.v.txt == "m"