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

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

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

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

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

n = A("n")
d = B("d")
g = C("g")
a = D("a")
m = E("m")
b = E("b")
k = C("k")

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

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

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

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

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

n = A("n")
d = B("d")
g = C("g")
a = D("a")
m = E("m")
b = E("b")
k = C("k")

n.z = a
n.y = g
n.x = d
n.w = d
n.p = k
d.v = a
d.q = a
d.y = b
g.o = a
g.u = d
g.p = d
g.y = n
a.z = m
m.t = g
m.x = g
m.r = g
m.y = d
m.v = n
b.t = g
b.x = k
b.r = k
b.y = d
b.v = n
k.o = a
k.u = d
k.p = d
k.y = n
assert k.p.y.x.p.txt == "d"