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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: A = None
        self.w: E = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

d.p = e
g.z = d
g.r = d
g.w = f
g.t = c
a.v = g
c.v = m
c.w = k
m.u = e
m.w = e
m.r = d
m.v = a
m.z = f
k.z = d
k.r = d
k.w = f
k.t = c
f.v = k
e.u = m
e.w = m
e.r = d
e.v = a
e.z = a
assert m.z.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: A = None
        self.w: E = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

d.p = e
g.z = d
g.r = d
g.w = f
g.t = c
a.v = g
c.v = m
c.w = k
m.u = e
m.w = e
m.r = d
m.v = a
m.z = f
k.z = d
k.r = d
k.w = f
k.t = c
f.v = k
e.u = m
e.w = m
e.r = d
e.v = a
e.z = a
assert m.z.v.t.txt == "c"