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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: D = None
        self.x: E = None
        self.t: A = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: E = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
h = C("h")
e = D("e")
n = E("n")

m.u = i
m.z = i
m.v = i
m.r = h
i.q = e
i.w = e
i.x = n
i.v = n
i.t = m
h.w = i
h.r = n
e.y = m
e.x = n
e.u = h
e.z = i
n.z = i
n.s = e
n.o = m
assert m.u.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.r: C = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: D = None
        self.x: E = None
        self.t: A = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: E = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
h = C("h")
e = D("e")
n = E("n")

m.u = i
m.z = i
m.v = i
m.r = h
i.q = e
i.w = e
i.x = n
i.v = n
i.t = m
h.w = i
h.r = n
e.y = m
e.x = n
e.u = h
e.z = i
n.z = i
n.s = e
n.o = m
assert m.u.w.z.q.txt == "e"