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

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

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

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

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

m = A("m")
l = B("l")
k = C("k")
i = D("i")
a = E("a")

m.r = a
m.z = l
m.t = l
m.o = k
l.z = k
l.y = k
l.w = a
k.o = m
k.u = i
i.p = a
i.u = l
i.q = l
i.t = l
i.y = k
a.r = m
a.y = l
assert k.u.y.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: B = None
        self.o: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

m = A("m")
l = B("l")
k = C("k")
i = D("i")
a = E("a")

m.r = a
m.z = l
m.t = l
m.o = k
l.z = k
l.y = k
l.w = a
k.o = m
k.u = i
i.p = a
i.u = l
i.q = l
i.t = l
i.y = k
a.r = m
a.y = l
assert k.u.y.o.r.txt == "a"