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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: B = None
        self.q: B = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

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

h = A("h")
m = B("m")
n = C("n")
b = D("b")
a = E("a")
l = A("l")
i = E("i")
j = E("j")

h.r = m
h.p = a
h.s = l
h.o = n
h.w = n
m.s = h
n.v = h
b.v = j
b.u = m
b.q = m
b.s = h
b.p = h
a.s = b
a.w = b
a.y = m
l.r = m
l.p = a
l.s = h
l.o = n
l.w = n
i.s = b
i.w = b
i.y = m
j.s = b
j.w = b
j.y = m
assert m.s.p.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: E = None
        self.s: A = None
        self.o: C = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: B = None
        self.q: B = None
        self.s: A = None
        self.p: A = None
        self.txt = txt

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

h = A("h")
m = B("m")
n = C("n")
b = D("b")
a = E("a")
l = A("l")
i = E("i")
j = E("j")

h.r = m
h.p = a
h.s = l
h.o = n
h.w = n
m.s = h
n.v = h
b.v = j
b.u = m
b.q = m
b.s = h
b.p = h
a.s = b
a.w = b
a.y = m
l.r = m
l.p = a
l.s = h
l.o = n
l.w = n
i.s = b
i.w = b
i.y = m
j.s = b
j.w = b
j.y = m
assert m.s.p.s.q.s.txt == "h"