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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: A = None
        self.v: C = None
        self.s: C = None
        self.txt = txt

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

e = A("e")
m = B("m")
f = C("f")
k = D("k")
n = E("n")

e.z = f
e.o = m
e.v = m
m.y = n
m.p = n
f.v = e
f.x = e
f.r = m
f.s = n
f.p = k
k.p = f
k.v = f
k.s = f
k.y = e
n.u = f
n.z = e
n.x = k
assert n.z.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: A = None
        self.v: C = None
        self.s: C = None
        self.txt = txt

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

e = A("e")
m = B("m")
f = C("f")
k = D("k")
n = E("n")

e.z = f
e.o = m
e.v = m
m.y = n
m.p = n
f.v = e
f.x = e
f.r = m
f.s = n
f.p = k
k.p = f
k.v = f
k.s = f
k.y = e
n.u = f
n.z = e
n.x = k
assert n.z.o.p.txt == "n"