#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int> op(n);
  set<pair<int, int> > s;
  for (int i = 0; i < n; ++i) {
    if (a[i] == 0) {
      int ile = min(3, (int)s.size());
      for (int j = 0; j < ile; ++j) {
        pair<int, int> x = *s.begin();
        s.erase(s.begin());
        op[x.second] = j;
      }
      while (s.size() != 0) {
        pair<int, int> x = *s.begin();
        s.erase(s.begin());
        op[x.second] = -1;
      }
      op[i] = ile;
    } else
      s.insert(make_pair(-a[i], i));
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] == 0) {
      cout << op[i];
      if (op[i] == 1) cout << " popStack";
      if (op[i] == 2) cout << " popStack popQueue";
      if (op[i] == 3) cout << " popStack popQueue popFront";
    } else {
      if (op[i] == -1) cout << "pushBack";
      if (op[i] == 0) cout << "pushStack";
      if (op[i] == 1) cout << "pushQueue";
      if (op[i] == 2) cout << "pushFront";
    }
    cout << "\n";
  }
  return 0;
}
