#include <bits/stdc++.h>
using namespace std;
string s;
long long g, h, i, j, k, l, m, n, o, p, q, r, t, u, v, w, x, y, z;
vector<int> a;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (x)
      a.push_back(x);
    else {
      if (a.size() == 0) {
        cout << "0\n";
      } else {
        while (a.size() < 3) a.push_back(-1);
        int max[3] = {0, -1, -1};
        j = 0;
        int ii;
        for (ii = 1; ii < a.size(); ii++)
          if (a[ii] >= a[max[0]]) max[0] = ii;
        for (ii = 0; ii < a.size(); ii++)
          if (ii != max[0] && (max[1] == -1 || a[ii] >= a[max[1]])) max[1] = ii;
        for (ii = 0; ii < a.size(); ii++)
          if (ii != max[0] && ii != max[1] &&
              (max[2] == -1 || a[ii] >= a[max[2]]))
            max[2] = ii;
        j = 0;
        for (ii = 0; ii < a.size(); ii++) {
          if (a[ii] != -1) {
            if (ii == max[0] || ii == max[1] || ii == max[2]) {
              switch (j) {
                case 0:
                  cout << "pushStack\n";
                  break;
                case 1:
                  cout << "pushQueue\n";
                  break;
                case 2:
                  cout << "pushFront\n";
              }
              j++;
            } else {
              cout << "pushBack\n";
            }
          }
        }
        cout << j;
        switch (j - 1) {
          case 2:
            cout << " popFront";
          case 1:
            cout << " popQueue";
          case 0:
            cout << " popStack";
        }
        cout << '\n';
        a.clear();
      }
    }
  }
  for (i = 0; i < a.size(); i++) {
    cout << "pushBack\n";
  }
  return 0;
}
