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

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

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

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

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

g = A("g")
l = B("l")
h = C("h")
k = D("k")
j = E("j")
n = D("n")
e = E("e")
d = C("d")
c = C("c")

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

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

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

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

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

g = A("g")
l = B("l")
h = C("h")
k = D("k")
j = E("j")
n = D("n")
e = E("e")
d = C("d")
c = C("c")

g.x = j
g.z = l
g.v = l
g.o = l
g.w = c
l.w = g
l.x = g
l.q = k
l.s = k
l.z = e
h.v = n
h.q = d
k.p = j
k.t = j
k.s = g
j.u = k
j.q = e
j.x = e
j.v = g
n.p = j
n.t = j
n.s = g
e.u = k
e.q = j
e.x = j
e.v = g
d.v = k
d.q = h
c.v = k
c.q = d
assert n.t.v.w.q.q.q.q.txt == "h"