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

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

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

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

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

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

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

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

e.t = d
e.z = a
e.r = m
e.q = m
a.t = g
a.s = h
a.y = d
a.x = m
c.z = d
g.u = m
g.x = c
m.s = g
m.y = g
m.p = h
m.z = h
m.o = e
d.t = g
d.s = c
d.y = a
d.x = m
h.z = a
assert m.o.z.s.z.txt == "a"