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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: A = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: A = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

g.o = b
g.q = n
g.w = n
g.y = d
g.t = h
n.r = a
n.z = g
n.s = g
n.x = b
b.o = a
b.t = g
b.z = g
b.q = h
a.z = h
a.v = h
a.x = b
a.u = m
h.u = g
h.p = g
h.v = g
h.q = d
m.z = h
m.v = h
m.x = b
m.u = a
d.r = a
d.z = g
d.s = g
d.x = b
assert d.r.z.q.z.t.txt == "h"