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

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

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

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

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

n.r = l
n.p = e
n.z = e
e.z = c
l.t = k
m.v = n
i.t = k
k.t = l
c.v = n
assert c.v.z.z.v.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

n.r = l
n.p = e
n.z = e
e.z = c
l.t = k
m.v = n
i.t = k
k.t = l
c.v = n
assert c.v.z.z.v.r.t.txt == "k"