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

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

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

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

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

n = A("n")
m = B("m")
d = C("d")
l = D("l")
j = E("j")
c = D("c")
e = C("e")

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

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

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

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

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

n = A("n")
m = B("m")
d = C("d")
l = D("l")
j = E("j")
c = D("c")
e = C("e")

n.z = j
n.w = j
n.o = m
m.r = c
m.v = l
m.p = l
d.o = c
d.s = e
d.r = e
l.t = n
l.p = e
j.u = c
j.v = l
j.t = n
c.t = n
c.p = d
e.o = c
e.s = d
e.r = d
assert l.p.o.p.r.r.txt == "d"