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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: C = None
        self.p: E = None
        self.q: E = None
        self.y: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
a = C("a")
h = D("h")
m = E("m")

k.q = h
e.u = m
e.p = m
e.q = m
e.r = a
e.y = a
a.v = h
h.o = k
h.z = a
h.t = m
h.p = m
m.o = a
m.y = e
m.v = e
m.q = e
assert m.y.q.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: C = None
        self.p: E = None
        self.q: E = None
        self.y: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
a = C("a")
h = D("h")
m = E("m")

k.q = h
e.u = m
e.p = m
e.q = m
e.r = a
e.y = a
a.v = h
h.o = k
h.z = a
h.t = m
h.p = m
m.o = a
m.y = e
m.v = e
m.q = e
assert m.y.q.o.v.txt == "h"