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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

f.z = m
f.y = a
f.p = c
f.v = k
f.u = e
a.t = i
a.v = m
a.w = j
a.q = j
d.w = e
j.u = n
m.x = j
m.z = j
k.t = i
k.v = m
k.w = j
k.q = j
n.z = m
n.y = k
n.u = k
n.p = f
n.v = a
e.t = d
e.v = m
e.w = j
e.q = j
i.w = a
c.z = m
c.y = k
c.v = k
c.u = k
c.p = n
assert m.z.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: B = None
        self.p: A = None
        self.v: B = None
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

f.z = m
f.y = a
f.p = c
f.v = k
f.u = e
a.t = i
a.v = m
a.w = j
a.q = j
d.w = e
j.u = n
m.x = j
m.z = j
k.t = i
k.v = m
k.w = j
k.q = j
n.z = m
n.y = k
n.u = k
n.p = f
n.v = a
e.t = d
e.v = m
e.w = j
e.q = j
i.w = a
c.z = m
c.y = k
c.v = k
c.u = k
c.p = n
assert m.z.u.p.txt == "f"