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

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

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

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

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

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

n.w = j
n.u = j
n.s = j
n.y = e
n.x = k
j.x = n
j.p = a
j.z = k
j.u = k
k.v = e
e.z = k
a.t = n
a.w = n
assert n.s.p.w.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.x: C = None
        self.u: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

n.w = j
n.u = j
n.s = j
n.y = e
n.x = k
j.x = n
j.p = a
j.z = k
j.u = k
k.v = e
e.z = k
a.t = n
a.w = n
assert n.s.p.w.x.v.txt == "e"