#include <bits/stdc++.h>
using namespace std;
struct data {
  int value, pos;
  data() {}
  data(int a, int b) {
    value = a;
    pos = b;
  }
  bool friend operator<(data A, data B) {
    if (A.value == B.value) return A.pos < B.pos;
    return A.value > B.value;
  }
};
vector<data> v, tmp;
int ar[100010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  int com;
  cin >> com;
  for (int i = 0; i < com; i++) {
    int val;
    cin >> val;
    if (val == 0) {
      tmp = v;
      sort(v.begin(), v.end());
      int sz = v.size();
      for (int i = 0; i < sz; i++) ar[i] = v[i].pos;
      for (int i = 0; i < sz; i++) {
        if (tmp[i].pos == ar[0])
          cout << "pushStack" << endl;
        else if (sz > 0 && tmp[i].pos == ar[1])
          cout << "pushQueue" << endl;
        else if (sz > 1 && tmp[i].pos == ar[2])
          cout << "pushFront" << endl;
        else
          cout << "pushBack" << endl;
      }
      if (sz == 0)
        cout << 0 << endl;
      else if (sz == 1)
        cout << "1 popStack" << endl;
      else if (sz == 2)
        cout << "2 popStack popQueue" << endl;
      else if (sz >= 3)
        cout << "3 popStack popQueue popFront" << endl;
      v.clear();
      tmp.clear();
    } else
      v.push_back(data(val, i));
  }
  tmp = v;
  sort(v.begin(), v.end());
  int sz = v.size();
  for (int i = 0; i < sz; i++) ar[i] = v[i].pos;
  for (int i = 0; i < sz; i++) {
    if (tmp[i].pos == ar[0])
      cout << "pushStack" << endl;
    else if (i > 0 && tmp[i].pos == ar[1])
      cout << "pushQueue" << endl;
    else if (i > 1 && tmp[i].pos == ar[2])
      cout << "pushFront" << endl;
    else
      cout << "pushBack" << endl;
  }
  return 0;
}
