class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: E = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: E = None
        self.z: E = None
        self.w: E = None
        self.x: D = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
a = C("a")
h = D("h")
k = E("k")
m = C("m")
i = E("i")
d = B("d")
b = E("b")

n.t = a
g.y = d
g.t = i
g.q = m
a.o = h
a.x = h
a.t = b
a.z = b
a.w = i
h.u = a
h.o = n
h.t = k
k.t = n
k.o = a
m.o = h
m.x = h
m.t = b
m.w = b
m.z = k
i.t = n
i.o = a
d.y = g
d.t = i
d.q = a
b.t = n
b.o = m
assert h.o.t.x.o.t.w.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: E = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: E = None
        self.z: E = None
        self.w: E = None
        self.x: D = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
a = C("a")
h = D("h")
k = E("k")
m = C("m")
i = E("i")
d = B("d")
b = E("b")

n.t = a
g.y = d
g.t = i
g.q = m
a.o = h
a.x = h
a.t = b
a.z = b
a.w = i
h.u = a
h.o = n
h.t = k
k.t = n
k.o = a
m.o = h
m.x = h
m.t = b
m.w = b
m.z = k
i.t = n
i.o = a
d.y = g
d.t = i
d.q = a
b.t = n
b.o = m
assert h.o.t.x.o.t.w.o.x.txt == "h"