#include <bits/stdc++.h>
using namespace std;
const int inf = numeric_limits<int>::max();
const long long linf = numeric_limits<long long>::max();
const int maxn = 100005;
const double EPS = 1e-9;
bool useful[maxn];
int query[maxn];
string t[] = {"popQueue", "popFront", "popStack"};
int main() {
  int n, a;
  bool fst = true;
  vector<int> last;
  set<pair<int, int>, greater<pair<int, int> > > S;
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &a);
    if (a == 0) {
      int taken = 0;
      int que = -1, deck = -1;
      while (S.size() > 0 && taken < 3) {
        useful[S.begin()->second] = true;
        ++taken;
        S.erase(S.begin());
      }
      for (__typeof((last).begin()) j = (last).begin(); j != (last).end();
           j++) {
        if (!fst) printf("\n");
        if (useful[*j]) {
          if (que == -1) {
            printf("pushQueue");
            que = 1;
          } else if (deck == -1) {
            printf("pushFront");
            deck = 1;
          } else
            printf("pushStack");
        } else
          printf("pushBack");
        fst = false;
      }
      if (!fst) printf("\n");
      printf("%d", taken);
      fst = false;
      if (taken) printf(" ");
      for (int i = 0; i < (taken); ++i) {
        printf("%s", t[i].c_str());
        if (i + 1 < taken) printf(" ");
      }
      last.clear();
      S.clear();
    } else {
      last.push_back(i);
      S.insert(make_pair(a, i));
    }
  }
  while (last.size() > 0) {
    if (!fst) printf("\n");
    fst = false;
    printf("pushBack");
    last.pop_back();
  }
  return 0;
}
