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

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

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

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

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

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

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

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

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

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

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

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

m.z = i
i.p = l
b.v = i
b.p = n
e.r = n
l.s = e
n.z = i
k.z = i
assert n.z.p.s.r.z.p.txt == "l"