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

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

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

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

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

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

n.p = k
n.y = k
n.s = k
n.o = m
b.w = k
k.r = h
h.r = k
m.w = l
m.z = l
m.r = l
i.p = k
i.y = k
i.s = k
i.o = m
l.r = k
a.w = k
g.p = k
g.y = k
g.s = k
g.o = m
assert m.w.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.y: C = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

n.p = k
n.y = k
n.s = k
n.o = m
b.w = k
k.r = h
h.r = k
m.w = l
m.z = l
m.r = l
i.p = k
i.y = k
i.s = k
i.o = m
l.r = k
a.w = k
g.p = k
g.y = k
g.s = k
g.o = m
assert m.w.r.r.r.r.r.txt == "k"