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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.x: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.x: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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