#include <bits/stdc++.h>
using namespace std;
bool comp1(const pair<pair<int, int>, string> &a,
           const pair<pair<int, int>, string> &b) {
  return a.first.first <= b.first.first;
}
bool comp2(const pair<pair<int, int>, string> &a,
           const pair<pair<int, int>, string> &b) {
  return a.first.second < b.first.second;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int idx = 0;
  vector<pair<pair<int, int>, string> > A;
  for (int i = 0; i < (n); i++) {
    int x;
    cin >> x;
    if (x == 0) {
      sort(A.begin(), A.end(), comp1);
      int sz = A.size();
      for (int i = 0; i < (sz - 3); i++) {
        A[i].second = "pushBack";
      }
      if (sz - 3 >= 0) {
        A[sz - 3].second = "pushStack";
        A[sz - 2].second = "pushQueue";
        A[sz - 1].second = "pushFront";
      } else if (sz - 2 >= 0) {
        A[sz - 2].second = "pushStack";
        A[sz - 1].second = "pushQueue";
      } else if (sz - 1 >= 0) {
        A[sz - 1].second = "pushStack";
      }
      sort(A.begin(), A.end(), comp2);
      for (int i = 0; i < (sz); i++) cout << A[i].second << endl;
      if (sz == 0) {
        cout << 0 << endl;
      } else if (sz == 1) {
        cout << 1 << " popStack\n";
      } else if (sz == 2) {
        cout << 2 << " popStack popQueue\n";
      } else {
        cout << 3 << " popStack popQueue popFront\n";
      }
      idx = 0;
      A.clear();
    } else {
      A.push_back(make_pair(make_pair(x, idx), ""));
      idx++;
    }
  }
  for (int i = 0; i < (A.size()); i++) {
    cout << "pushStack\n";
  }
  return 0;
}
