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

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

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

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

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

n = A("n")
h = B("h")
l = C("l")
d = D("d")
m = E("m")
a = E("a")
e = B("e")
b = B("b")
c = B("c")

n.u = a
n.p = a
h.r = n
l.w = a
l.o = h
d.o = b
m.u = n
m.v = n
m.q = l
m.o = e
m.p = h
a.u = n
a.v = n
a.q = l
a.o = c
a.p = b
e.r = n
b.r = n
c.r = n
assert l.w.o.r.p.p.r.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

n = A("n")
h = B("h")
l = C("l")
d = D("d")
m = E("m")
a = E("a")
e = B("e")
b = B("b")
c = B("c")

n.u = a
n.p = a
h.r = n
l.w = a
l.o = h
d.o = b
m.u = n
m.v = n
m.q = l
m.o = e
m.p = h
a.u = n
a.v = n
a.q = l
a.o = c
a.p = b
e.r = n
b.r = n
c.r = n
assert l.w.o.r.p.p.r.u.q.txt == "l"