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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: E = None
        self.u: E = None
        self.y: C = 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.x: A = None
        self.y: A = None
        self.s: A = None
        self.r: A = None
        self.txt = txt

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

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

j.x = g
j.u = i
j.q = h
e.q = j
e.z = h
e.u = h
e.y = c
d.z = e
i.x = j
i.y = j
i.s = j
i.r = j
h.o = g
h.z = a
g.x = j
g.y = j
g.s = j
g.r = j
c.z = e
a.z = e
assert e.u.z.z.u.o.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: D = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: E = None
        self.u: E = None
        self.y: C = 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.x: A = None
        self.y: A = None
        self.s: A = None
        self.r: A = None
        self.txt = txt

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

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

j.x = g
j.u = i
j.q = h
e.q = j
e.z = h
e.u = h
e.y = c
d.z = e
i.x = j
i.y = j
i.s = j
i.r = j
h.o = g
h.z = a
g.x = j
g.y = j
g.s = j
g.r = j
c.z = e
a.z = e
assert e.u.z.z.u.o.x.q.txt == "h"