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

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

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

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

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

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

k.p = n
k.y = l
k.z = f
e.z = k
e.x = k
e.v = i
i.v = l
i.t = l
i.p = n
i.w = m
i.z = e
m.t = e
m.s = n
n.t = e
f.t = e
f.s = n
l.v = i
l.t = i
l.p = n
l.w = f
l.z = e
assert n.t.x.z.t.v.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: C = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

k.p = n
k.y = l
k.z = f
e.z = k
e.x = k
e.v = i
i.v = l
i.t = l
i.p = n
i.w = m
i.z = e
m.t = e
m.s = n
n.t = e
f.t = e
f.s = n
l.v = i
l.t = i
l.p = n
l.w = f
l.z = e
assert n.t.x.z.t.v.w.s.txt == "n"