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

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

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

e = A("e")
d = B("d")
m = C("m")
a = B("a")
k = B("k")
i = C("i")

e.y = a
e.s = d
d.z = e
d.s = e
m.p = d
a.z = e
a.s = e
k.z = e
k.s = e
i.p = d
assert k.z.s.s.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
m = C("m")
a = B("a")
k = B("k")
i = C("i")

e.y = a
e.s = d
d.z = e
d.s = e
m.p = d
a.z = e
a.s = e
k.z = e
k.s = e
i.p = d
assert k.z.s.s.y.z.txt == "e"