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

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

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

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

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

k = A("k")
f = B("f")
c = C("c")
d = D("d")
a = E("a")

k.s = d
k.p = d
k.z = a
k.r = a
k.u = a
f.r = c
f.z = a
f.q = d
f.o = k
c.x = d
c.y = k
c.z = a
d.p = c
a.u = d
a.w = d
a.p = f
a.y = f
assert f.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: E = None
        self.r: E = None
        self.u: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

k = A("k")
f = B("f")
c = C("c")
d = D("d")
a = E("a")

k.s = d
k.p = d
k.z = a
k.r = a
k.u = a
f.r = c
f.z = a
f.q = d
f.o = k
c.x = d
c.y = k
c.z = a
d.p = c
a.u = d
a.w = d
a.p = f
a.y = f
assert f.z.y.z.txt == "a"