For each state qi of the PDA, we add the rule Aii -> e
        For each triplet of states qi, qj and qk, we add the rule Aij -> Aik Akj.
        Args:
            optimized (bool): Enable or Disable optimization - Do not produce O(n^3)

def insert_self_to_empty_and_insert_all_intemediate(self, optimized):
        """
        For each state qi of the PDA, we add the rule Aii -> e
        For each triplet of states qi, qj and qk, we add the rule Aij -> Aik Akj.
        Args:
            optimized (bool): Enable or Disable optimization - Do not produce O(n^3)
        """
        for state_a in self.statediag:
            self.rules.append('A' +repr(state_a.id) +',' + repr(state_a.id) + ': @empty_set')

            # If CFG is not requested, avoid the following O(n^3) rule.
            # It can be solved and a string can be generated faster with BFS of DFS

            if optimized == 0:
                for state_b in self.statediag:
                    if state_b.id != state_a.id:
                        for state_c in self.statediag:
                            if state_c.id != state_a.id \
                                    and state_b.id != state_c.id:
                                self.rules.append('A' + repr(state_a.id)
                                                  + ',' + repr(state_c.id)
                                                  + ': A' + repr(state_a.id)
                                                  + ',' + repr(state_b.id)
                                                  + ' A' + repr(state_b.id)
                                                  + ',' + repr(state_c.id)
                                                  + '')