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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: A = None
        self.v: A = None
        self.q: E = None
        self.txt = txt

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

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

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

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

m.p = h
m.o = j
m.w = j
i.s = h
i.w = l
i.v = l
i.q = j
h.s = i
h.p = i
e.v = h
e.z = h
e.w = l
e.x = m
j.t = e
j.s = h
j.q = h
l.p = h
l.o = j
l.w = j
assert m.w.q.s.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: A = None
        self.v: A = None
        self.q: E = None
        self.txt = txt

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

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

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

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

m.p = h
m.o = j
m.w = j
i.s = h
i.w = l
i.v = l
i.q = j
h.s = i
h.p = i
e.v = h
e.z = h
e.w = l
e.x = m
j.t = e
j.s = h
j.q = h
l.p = h
l.o = j
l.w = j
assert m.w.q.s.v.p.txt == "h"