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

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

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

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

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

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

e.v = n
e.p = n
c.t = m
i.r = e
i.s = e
n.w = m
k.p = c
k.y = c
m.w = n
assert k.p.t.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

e.v = n
e.p = n
c.t = m
i.r = e
i.s = e
n.w = m
k.p = c
k.y = c
m.w = n
assert k.p.t.w.w.w.txt == "n"