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

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

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

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

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

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

i.u = d
f.r = m
f.q = g
h.x = m
m.s = h
m.z = k
m.o = k
m.t = n
n.u = h
g.r = m
g.q = c
k.x = m
c.r = m
c.q = g
d.u = h
assert n.u.x.t.u.x.t.u.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

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

i.u = d
f.r = m
f.q = g
h.x = m
m.s = h
m.z = k
m.o = k
m.t = n
n.u = h
g.r = m
g.q = c
k.x = m
c.r = m
c.q = g
d.u = h
assert n.u.x.t.u.x.t.u.x.s.txt == "h"