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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: D = None
        self.w: C = None
        self.z: A = None
        self.q: C = None
        self.txt = txt

n = A("n")
d = B("d")
l = C("l")
m = D("m")
b = E("b")
a = E("a")
g = E("g")

n.o = b
n.z = m
d.r = b
d.z = b
d.w = g
d.p = l
d.o = l
l.u = n
m.q = l
m.u = a
m.w = n
b.s = n
b.z = n
b.u = m
b.w = l
b.q = l
a.s = n
a.z = n
a.u = m
a.w = l
a.q = l
g.s = n
g.z = n
g.u = m
g.w = l
g.q = l
assert d.r.q.u.z.q.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: D = None
        self.w: C = None
        self.z: A = None
        self.q: C = None
        self.txt = txt

n = A("n")
d = B("d")
l = C("l")
m = D("m")
b = E("b")
a = E("a")
g = E("g")

n.o = b
n.z = m
d.r = b
d.z = b
d.w = g
d.p = l
d.o = l
l.u = n
m.q = l
m.u = a
m.w = n
b.s = n
b.z = n
b.u = m
b.w = l
b.q = l
a.s = n
a.z = n
a.u = m
a.w = l
a.q = l
g.s = n
g.z = n
g.u = m
g.w = l
g.q = l
assert d.r.q.u.z.q.u.z.txt == "m"