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

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

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

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

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

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

n.t = c
n.p = c
n.q = c
n.o = c
d.s = a
d.o = n
d.t = n
d.q = c
d.w = l
l.o = c
l.s = c
l.w = n
l.u = n
l.v = n
c.x = l
a.s = d
a.r = c
m.s = a
m.o = n
m.t = n
m.q = c
m.w = l
assert a.s.o.q.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: D = None
        self.q: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

n.t = c
n.p = c
n.q = c
n.o = c
d.s = a
d.o = n
d.t = n
d.q = c
d.w = l
l.o = c
l.s = c
l.w = n
l.u = n
l.v = n
c.x = l
a.s = d
a.r = c
m.s = a
m.o = n
m.t = n
m.q = c
m.w = l
assert a.s.o.q.x.s.txt == "c"