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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: A = None
        self.s: A = None
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

h = A("h")
m = B("m")
k = C("k")
l = D("l")
i = E("i")

h.w = m
h.p = i
m.z = k
m.s = h
m.q = l
k.w = m
k.y = i
l.o = h
l.r = h
l.s = h
l.w = k
l.t = m
i.r = l
i.u = l
i.p = m
i.w = m
assert l.s.p.r.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: A = None
        self.s: A = None
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

h = A("h")
m = B("m")
k = C("k")
l = D("l")
i = E("i")

h.w = m
h.p = i
m.z = k
m.s = h
m.q = l
k.w = m
k.y = i
l.o = h
l.r = h
l.s = h
l.w = k
l.t = m
i.r = l
i.u = l
i.p = m
i.w = m
assert l.s.p.r.w.w.txt == "m"