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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: A = None
        self.q: E = None
        self.txt = txt

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

n.w = h
n.p = h
b.s = g
b.u = i
k.r = n
a.w = h
a.s = k
i.o = a
i.r = n
i.q = c
j.o = h
j.r = n
j.q = i
l.s = k
l.u = c
h.w = a
h.s = g
c.o = a
c.r = n
c.q = i
g.r = n
assert l.s.r.p.s.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: A = None
        self.q: E = None
        self.txt = txt

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

n.w = h
n.p = h
b.s = g
b.u = i
k.r = n
a.w = h
a.s = k
i.o = a
i.r = n
i.q = c
j.o = h
j.r = n
j.q = i
l.s = k
l.u = c
h.w = a
h.s = g
c.o = a
c.r = n
c.q = i
g.r = n
assert l.s.r.p.s.r.w.txt == "h"