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

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

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

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

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

n = A("n")
l = B("l")
e = C("e")
h = D("h")
j = E("j")
c = C("c")

n.s = h
l.z = n
l.u = j
l.o = j
e.v = c
e.w = h
h.p = n
j.z = h
c.v = e
c.w = h
assert c.w.p.s.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

n = A("n")
l = B("l")
e = C("e")
h = D("h")
j = E("j")
c = C("c")

n.s = h
l.z = n
l.u = j
l.o = j
e.v = c
e.w = h
h.p = n
j.z = h
c.v = e
c.w = h
assert c.w.p.s.p.s.p.txt == "n"