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

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

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

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

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

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

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

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

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

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

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

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

m.q = k
m.v = a
k.x = i
k.r = i
k.u = i
k.o = m
a.s = i
i.z = b
i.p = b
i.y = a
i.t = k
i.q = k
b.z = m
b.v = m
assert i.y.s.z.z.q.txt == "k"