#include <bits/stdc++.h>
using namespace std;
const int N = 300500;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    vector<pair<int, int> > vec;
    int len = 1;
    while (i < n && arr[i] != 0) {
      vec.push_back({arr[i], len});
      i++;
      len++;
    }
    if (i == n) {
      int t = len - 1;
      while (t--) cout << "pushStack\n";
    } else {
      sort(vec.begin(), vec.end());
      if (vec.size() == 0)
        cout << "0\n";
      else if (i < n && vec.size() == 1)
        cout << "pushStack\n1 popStack\n";
      else if (i < n && vec.size() == 2)
        cout << "pushStack\npushQueue\n2 popStack popQueue\n";
      else if (i < n && vec.size() == 3)
        cout << "pushStack\npushQueue\npushFront\n3 popStack popQueue "
                "popFront\n";
      else {
        len--;
        int max[3];
        max[0] = vec[len - 3].second;
        max[1] = vec[len - 2].second;
        max[2] = vec[len - 1].second;
        sort(max, max + 3);
        int pos1 = max[0], pos2 = max[1], pos3 = max[2];
        int t1 = pos1;
        while (t1--) cout << "pushStack\n";
        t1 = pos2 - pos1 - 1;
        while (t1--) cout << "pushFront\n";
        t1 = pos3 - pos2;
        while (t1--) cout << "pushQueue\n";
        cout << "pushBack\n";
        t1 = len - pos3;
        while (t1--) cout << "pushFront\n";
        if (i < n) cout << "3 popStack popQueue popBack\n";
      }
    }
  }
  return 0;
}
