#include <bits/stdc++.h>
using namespace std;
struct st {
  int val, pos;
};
bool comp(st x, st y) {
  if (x.val < y.val) return 1;
  return 0;
}
vector<st> a;
int ans[111111] = {};
int t[111111] = {};
int main() {
  int n, m;
  cin >> n;
  long sum = 0;
  make_heap(a.begin(), a.end(), comp);
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    if (t[i] > 0) {
      st temp;
      temp.val = t[i];
      temp.pos = i;
      a.push_back(temp);
      push_heap(a.begin(), a.end(), comp);
    }
    if (t[i] == 0) {
      for (int j = 1; j < 4; j++) {
        if (a.size() == 0) continue;
        ans[a.front().pos] = j;
        pop_heap(a.begin(), a.end(), comp);
        a.pop_back();
      }
      a.clear();
      make_heap(a.begin(), a.end(), comp);
    }
  }
  for (int i = 0; i < n; i++) {
    if (t[i] > 0) {
      if (ans[i] == 0) cout << "pushBack\n";
      if (ans[i] == 1) cout << "pushStack\n";
      if (ans[i] == 2) cout << "pushQueue\n";
      if (ans[i] == 3) cout << "pushFront\n";
      sum++;
    }
    if (t[i] == 0) {
      if (sum >= 3) {
        cout << "3 popStack popQueue popFront\n";
      }
      if (sum == 0) cout << "0\n";
      if (sum == 1) cout << "1 popStack\n";
      if (sum == 2) cout << "2 popStack popQueue\n";
      sum = 0;
    }
  }
}
