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

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

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

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

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

j = A("j")
e = B("e")
l = C("l")
m = D("m")
h = E("h")
n = C("n")
k = C("k")
g = B("g")

j.p = k
j.y = g
j.r = m
e.o = j
e.w = m
e.t = m
e.p = g
l.y = g
l.s = m
m.w = h
h.q = k
h.p = j
h.w = j
h.z = e
h.o = l
n.y = g
n.s = m
k.y = g
k.s = m
g.o = j
g.w = m
g.t = m
g.p = e
assert m.w.q.s.w.q.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

j = A("j")
e = B("e")
l = C("l")
m = D("m")
h = E("h")
n = C("n")
k = C("k")
g = B("g")

j.p = k
j.y = g
j.r = m
e.o = j
e.w = m
e.t = m
e.p = g
l.y = g
l.s = m
m.w = h
h.q = k
h.p = j
h.w = j
h.z = e
h.o = l
n.y = g
n.s = m
k.y = g
k.s = m
g.o = j
g.w = m
g.t = m
g.p = e
assert m.w.q.s.w.q.s.w.txt == "h"