#include <bits/stdc++.h>
using namespace std;
long long min3(long long a, long long b, long long c) {
  return min(a, min(b, c));
}
map<pair<long long, long long>, long long> mymap;
long long pos[3], p[3], done[3];
long long final[100005];
int main() {
  long long k, n, i, ctr = 0;
  cin >> n;
  long long oper[n], prev = 0;
  for (i = 0; i < n; i++) {
    cin >> oper[i];
    if (oper[i] == 0 || (i == n - 1 && oper[i] != 0)) {
      if (i == n - 1 && oper[i] != 0) {
        mymap[make_pair(oper[i], i)]++;
        i++;
      }
      ctr = 0;
      done[0] = done[1] = done[2] = -1;
      for (map<pair<long long, long long>, long long>::reverse_iterator rit =
               mymap.rbegin();
           rit != mymap.rend(); ++rit) {
        if (done[1] == -1) {
          final[(rit->first).second] = 1;
          done[1] = (rit->first).second;
          ctr++;
        } else if (done[0] == -1) {
          final[(rit->first).second] = 2;
          done[0] = (rit->first).second;
          ctr++;
        } else if (done[2] == -1) {
          final[(rit->first).second] = 3;
          done[2] = (rit->first).second;
          ctr++;
        } else
          break;
      }
      int flag[3] = {0};
      for (k = prev; k < i; k++) {
        if (final[k] == -1) final[k] = 4;
        if (final[k] == 1) {
          cout << "pushQueue";
          flag[0] = 1;
        } else if (final[k] == 2) {
          cout << "pushStack";
          flag[1] = 1;
        } else if (final[k] == 3) {
          cout << "pushFront";
          flag[2] = 1;
        } else
          cout << "pushBack";
        cout << endl;
      }
      if (i < n && oper[i] == 0) {
        cout << flag[0] + flag[1] + flag[2];
        if (flag[1]) cout << " popStack";
        if (flag[0]) cout << " popQueue";
        if (flag[2]) cout << " popFront";
        cout << endl;
        prev = i + 1;
        mymap.clear();
      }
    } else
      mymap[make_pair(oper[i], i)]++;
  }
  return 0;
}
