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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: B = None
        self.u: A = None
        self.w: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: B = None
        self.u: A = None
        self.w: B = None
        self.z: C = None
        self.txt = txt

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

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

i.r = n
i.u = a
i.w = a
i.q = g
n.q = a
n.o = a
n.w = d
n.p = m
n.t = h
m.z = n
h.t = m
h.z = m
h.y = n
h.w = n
h.u = g
a.z = n
d.q = a
d.o = a
d.w = n
d.p = m
d.t = h
g.r = n
g.u = a
g.w = a
g.q = c
c.r = n
c.u = a
c.w = a
c.q = f
f.r = d
f.u = a
f.w = a
f.q = g
assert n.p.z.q.z.w.t.u.txt == "g"