#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int> > Q;
pair<int, int> val[100010];
int n, top;
void print() {
  pair<int, int> ta, tb, tc;
  if (top == 1)
    printf("pushStack\n");
  else if (top == 2)
    printf("pushStack\npushQueue\n");
  else if (top == 3)
    printf("pushStack\npushQueue\npushFront\n");
  else if (top) {
    ta = Q.top(), Q.pop();
    tb = Q.top(), Q.pop();
    tc = Q.top(), Q.pop();
    for (int j = 1; j <= top; ++j) {
      if (val[j] == ta)
        printf("pushStack\n");
      else if (val[j] == tb)
        printf("pushQueue\n");
      else if (val[j] == tc)
        printf("pushFront\n");
      else
        printf("pushBack\n");
    }
  }
}
void read() {
  scanf("%d", &n);
  for (int i = 1, p; i <= n; ++i) {
    scanf("%d", &p);
    if (p == 0) {
      print();
      printf("%d", min(top, 3));
      if (top >= 1) printf(" popStack");
      if (top >= 2) printf(" popQueue");
      if (top >= 3) printf(" popFront");
      printf("\n");
      while (!Q.empty()) Q.pop();
      top = 0;
    } else
      Q.push(make_pair(p, i)), val[++top] = make_pair(p, i);
  }
  print();
}
int main() {
  read();
  return 0;
}
