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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: E = None
        self.txt = txt

n = A("n")
i = B("i")
l = C("l")
e = D("e")
g = E("g")
h = E("h")
a = D("a")
j = C("j")
k = B("k")
d = E("d")

n.r = j
n.t = j
n.u = a
n.z = h
i.q = k
l.o = g
e.p = l
e.z = k
g.q = h
g.o = d
h.q = g
h.o = d
a.p = j
a.z = i
j.o = d
k.q = i
d.q = h
d.o = h
assert h.o.o.o.q.q.o.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: D = None
        self.z: E = None
        self.t: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: E = None
        self.txt = txt

n = A("n")
i = B("i")
l = C("l")
e = D("e")
g = E("g")
h = E("h")
a = D("a")
j = C("j")
k = B("k")
d = E("d")

n.r = j
n.t = j
n.u = a
n.z = h
i.q = k
l.o = g
e.p = l
e.z = k
g.q = h
g.o = d
h.q = g
h.o = d
a.p = j
a.z = i
j.o = d
k.q = i
d.q = h
d.o = h
assert h.o.o.o.q.q.o.q.q.q.q.txt == "g"