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

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

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

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

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

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

i.z = n
i.o = e
n.y = e
n.z = h
n.s = i
n.t = k
k.r = e
k.o = i
h.x = k
h.z = n
h.s = e
e.p = h
e.q = i
assert k.o.o.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

i.z = n
i.o = e
n.y = e
n.z = h
n.s = i
n.t = k
k.r = e
k.o = i
h.x = k
h.z = n
h.s = e
e.p = h
e.q = i
assert k.o.o.p.s.txt == "e"