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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: E = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

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

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

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

l.w = d
l.r = d
l.z = i
a.p = h
b.w = l
b.t = j
b.u = h
b.v = n
h.r = c
h.z = d
j.u = l
d.u = l
e.r = b
e.z = d
c.w = l
c.t = j
c.u = e
c.v = n
i.p = h
n.r = b
n.z = j
assert l.r.u.z.p.r.t.u.w.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: B = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: E = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

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

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

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

l.w = d
l.r = d
l.z = i
a.p = h
b.w = l
b.t = j
b.u = h
b.v = n
h.r = c
h.z = d
j.u = l
d.u = l
e.r = b
e.z = d
c.w = l
c.t = j
c.u = e
c.v = n
i.p = h
n.r = b
n.z = j
assert l.r.u.z.p.r.t.u.w.u.r.txt == "d"