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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.z: C = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

g.q = h
g.o = f
g.t = f
g.v = i
g.u = l
c.s = i
c.x = g
c.o = l
c.q = h
c.u = f
f.s = h
f.p = n
f.z = i
f.u = i
f.w = c
n.w = c
l.r = f
h.w = c
e.w = c
a.s = i
a.x = g
a.o = l
a.q = n
a.u = f
i.s = e
i.p = e
i.z = f
i.u = f
i.w = a
assert e.w.u.w.x.u.r.w.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: C = None
        self.v: C = None
        self.t: C = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.z: C = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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