#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
template <class T>
inline void smin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void smax(T &a, T b) {
  if (a < b) a = b;
}
int a[111111], id[111111];
bool cmp(int u, int v) { return a[u] > a[v]; }
int main() {
  int N, i, j, k, nr, cntq, cnts, cntd;
  scanf("%d", &N);
  for (i = 0; i < N; i++) scanf("%d", a + i);
  for (i = 0; i < N; i = j) {
    if (a[i] == 0) {
      puts("0");
      j = i + 1;
    } else {
      for (j = i; j < N; j++) {
        if (a[j] == 0) break;
      }
      for (k = i; k < j; k++) id[k] = k;
      sort(id + i, id + j, cmp);
      cntq = cnts = cntd = 0;
      for (k = i; k < j; k++) {
        if (k == id[i]) {
          cntq++;
          puts("pushQueue");
          continue;
        }
        if (j - i > 1 && k == id[i + 1]) {
          cnts++;
          puts("pushStack");
          continue;
        }
        if (j - i > 2 && k == id[i + 2]) {
          cntd++;
          puts("pushBack");
          continue;
        }
        cntd++;
        puts("pushFront");
      }
      nr = 0;
      if (cntq) nr++;
      if (cnts) nr++;
      if (cntd) nr++;
      if (j < N) {
        printf("%d", nr);
        if (nr) printf(" popQueue");
        if (nr > 1) printf(" popStack");
        if (nr > 2) printf(" popBack");
        puts("");
        j++;
      }
    }
  }
  return 0;
}
