#include <bits/stdc++.h>
using namespace std;
int mark[(int)1e6];
int main() {
  int n, ct;
  cin >> n;
  vector<int> cmd(n);
  set<pair<int, int> > ss;
  set<pair<int, int> >::iterator it;
  for (int i = (0); i < (n); ++i) {
    cin >> cmd[i];
    if (cmd[i]) {
      ss.insert(make_pair(-cmd[i], i));
    } else {
      for (ct = 0, it = ss.begin(); it != ss.end() && ct < 3; ct++) {
        mark[it->second] = 1;
        ss.erase(it++);
      }
      ss.clear();
    }
  }
  int sst = 0, sq = 0, sdk = 0, k;
  vector<string> ops;
  for (int i = (0); i < (n); ++i) {
    if (cmd[i] == 0) {
      k = 0;
      ops.clear();
      if (sst > 0) {
        k++;
        ops.push_back("popStack");
        sst--;
      }
      if (sq > 0) {
        k++;
        ops.push_back("popQueue");
        sq--;
      }
      if (sdk > 0) {
        k++;
        ops.push_back("popFront");
        sdk--;
      }
      cout << k;
      if (k) cout << " ";
      for (int i = (0); i < (k - 1); ++i) {
        cout << ops[i] << " ";
      }
      if (k > 0) cout << ops[k - 1];
      cout << endl;
    } else {
      if (mark[i]) {
        if (sst <= sq && sst <= sdk) {
          cout << "pushStack\n";
          sst++;
        } else if (sq <= sst && sq <= sdk) {
          cout << "pushQueue\n";
          sq++;
        } else {
          cout << "pushFront\n";
          sdk++;
        }
      } else {
        cout << "pushBack\n";
      }
    }
  }
  return 0;
}
