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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.q: D = None
        self.v: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

n.q = l
n.o = f
n.z = j
l.u = f
l.o = b
l.q = a
l.v = e
l.p = c
b.x = c
b.w = n
c.q = n
c.s = a
h.z = a
g.u = f
g.o = b
g.q = a
g.v = e
g.p = c
e.z = c
j.q = l
j.o = f
j.z = f
a.q = n
a.s = c
f.q = l
f.o = j
f.z = n
assert e.z.s.s.s.s.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: A = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: C = None
        self.q: D = None
        self.v: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

n.q = l
n.o = f
n.z = j
l.u = f
l.o = b
l.q = a
l.v = e
l.p = c
b.x = c
b.w = n
c.q = n
c.s = a
h.z = a
g.u = f
g.o = b
g.q = a
g.v = e
g.p = c
e.z = c
j.q = l
j.o = f
j.z = f
a.q = n
a.s = c
f.q = l
f.o = j
f.z = n
assert e.z.s.s.s.s.s.s.q.txt == "n"