#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
struct node {
  int a, idx;
  bool operator<(const node t) const {
    if (a != t.a)
      return a < t.a;
    else
      return idx < t.idx;
  }
} s[maxn];
int q[maxn];
vector<node> p;
int main() {
  int n;
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &s[i].a);
    s[i].idx = i;
    if (s[i].a != 0) {
      p.push_back(s[i]);
    } else {
      sort(p.begin(), p.end());
      for (j = 1; j <= 3; j++) {
        if (!p.empty()) {
          q[p.back().idx] = 1;
          p.pop_back();
        }
      }
      p.clear();
    }
  }
  j = 0;
  for (i = 1; i <= n; i++) {
    if (s[i].a == 0) {
      printf("%d", j);
      if (j == 3)
        printf(" popStack popQueue popFront");
      else if (j == 2)
        printf(" popStack popQueue");
      else if (j == 1)
        printf(" popStack");
      printf("\n");
      j = 0;
    } else if (q[i]) {
      if (j == 0) printf("pushStack\n");
      if (j == 1) printf("pushQueue\n");
      if (j == 2) printf("pushFront\n");
      j++;
    } else
      printf("pushBack\n");
  }
  return 0;
}
