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

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

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

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

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

d = A("d")
g = B("g")
c = C("c")
n = D("n")
m = E("m")
l = C("l")
f = E("f")

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

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

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

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

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

d = A("d")
g = B("g")
c = C("c")
n = D("n")
m = E("m")
l = C("l")
f = E("f")

d.p = n
d.z = g
d.t = g
d.y = g
d.r = g
g.z = d
g.w = l
g.q = f
c.z = l
c.p = l
c.r = f
c.v = n
c.q = g
n.p = f
n.t = c
m.u = c
m.x = l
m.w = n
l.z = c
l.p = c
l.r = m
l.v = n
l.q = g
f.u = c
f.x = c
f.w = n
assert n.t.p.q.w.v.txt == "n"