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

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

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

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

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

f = A("f")
a = B("a")
i = C("i")
e = D("e")
k = E("k")

f.o = k
f.w = k
f.u = i
f.p = a
f.y = e
a.u = f
i.u = e
i.x = e
i.o = e
i.z = k
e.z = k
e.u = f
k.u = i
k.y = e
k.x = e
assert k.x.z.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: C = None
        self.p: B = None
        self.y: D = None
        self.w: E = None
        self.txt = txt

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

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

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

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

f = A("f")
a = B("a")
i = C("i")
e = D("e")
k = E("k")

f.o = k
f.w = k
f.u = i
f.p = a
f.y = e
a.u = f
i.u = e
i.x = e
i.o = e
i.z = k
e.z = k
e.u = f
k.u = i
k.y = e
k.x = e
assert k.x.z.x.z.x.txt == "e"