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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: E = None
        self.o: B = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
h = C("h")
m = D("m")
g = E("g")
n = D("n")
f = A("f")

e.u = h
a.o = n
h.x = f
h.t = g
h.u = g
h.o = a
h.z = a
m.x = f
m.z = n
m.q = n
m.u = e
m.s = g
g.z = e
g.x = h
n.x = f
n.z = m
n.q = m
n.u = e
n.s = g
f.u = h
assert h.u.z.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: E = None
        self.o: B = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
h = C("h")
m = D("m")
g = E("g")
n = D("n")
f = A("f")

e.u = h
a.o = n
h.x = f
h.t = g
h.u = g
h.o = a
h.z = a
m.x = f
m.z = n
m.q = n
m.u = e
m.s = g
g.z = e
g.x = h
n.x = f
n.z = m
n.q = m
n.u = e
n.s = g
f.u = h
assert h.u.z.u.x.u.txt == "h"