#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100050;
struct dot {
  int val, id;
};
bool operator<(dot a, dot b) {
  if (a.val == b.val) {
    return a.id < b.id;
  }
  return a.val < b.val;
}
int n, A[MAXN], t, r, cnt;
vector<int> V;
queue<int> Q;
deque<int> D;
bool saved[MAXN];
void add(int v) {
  if (r == 0) {
    printf("pushStack\n");
    V.push_back(v);
  } else if (r == 1) {
    printf("pushQueue\n");
    Q.push(v);
  } else if (r == 2) {
    printf("pushFront\n");
    D.push_front(v);
  }
  r = (r + 1) % 3;
}
void extract() {
  vector<string> ans;
  if (V.size()) {
    ans.push_back("popStack");
    V.clear();
  }
  if (Q.size()) {
    ans.push_back("popQueue");
    while (Q.size()) Q.pop();
  }
  if (D.size()) {
    ans.push_back("popFront");
    D.clear();
  }
  printf("%d", (int)ans.size());
  for (int i = (0); i < (int)(ans.size()); i++) {
    printf(" %s", ans[i].c_str());
  }
  puts("");
}
int main() {
  while (scanf("%d", &n) == 1) {
    V.clear();
    while (Q.size()) Q.pop();
    D.clear();
    r = 0;
    t = -1;
    cnt = 0;
    memset(saved, false, sizeof saved);
    for (int i = (0); i < (int)(n); i++) {
      scanf("%d", &A[i]);
    }
    t = -1;
    priority_queue<dot> P;
    for (int i = (t + 1); i < (int)(n); i++) {
      if (A[i] == 0) {
        int s = (int)P.size();
        for (int rep = (0); rep < (int)(min(3, s)); rep++) {
          dot v = P.top();
          P.pop();
          saved[v.id] = true;
        }
        while (P.size()) P.pop();
      } else {
        P.push({A[i], i});
      }
    }
    r = 0;
    for (int i = (t + 1); i < (int)(n); i++) {
      if (A[i] == 0) {
        extract();
      } else {
        if (saved[i]) {
          add(A[i]);
        } else {
          printf("pushBack\n");
        }
      }
    }
  }
  return 0;
}
