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

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

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

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

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

e = A("e")
k = B("k")
a = C("a")
l = D("l")
n = E("n")

e.v = k
k.q = e
k.z = a
k.w = l
a.x = l
l.z = a
l.x = a
l.u = a
l.q = n
n.p = e
assert e.v.w.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

e = A("e")
k = B("k")
a = C("a")
l = D("l")
n = E("n")

e.v = k
k.q = e
k.z = a
k.w = l
a.x = l
l.z = a
l.x = a
l.u = a
l.q = n
n.p = e
assert e.v.w.u.x.u.txt == "a"