#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int a[100010] = {0}, q[100010] = {0};
bool cmp(int a, int b) { return a > b; }
int main() {
  int t, test, x, n;
  scanf("%d", &test);
  for (t = 0; t < test; t++) {
    scanf("%d", &x);
    if (!x)
      puts("0");
    else {
      n = 0;
      q[n] = a[n++] = x;
      for (t++; t < test; t++) {
        scanf("%d", &x);
        if (!x) break;
        q[n] = a[n++] = x;
      }
      if (x) {
        for (int(i) = 0; (i) < (n); ++(i)) puts("pushStack");
      } else if (n == 1) {
        puts("pushStack");
        puts("1 popStack");
      } else if (n == 2) {
        puts("pushStack");
        puts("pushQueue");
        puts("2 popStack popQueue");
      } else {
        sort(a, a + n, cmp);
        bool stack = false, queue = false, deque = false;
        for (int(i) = 0; (i) < (n); ++(i)) {
          if (q[i] == a[0]) {
            if (!stack)
              stack = true, puts("pushStack");
            else if (!queue)
              queue = true, puts("pushQueue");
            else
              puts("pushFront");
          } else if (q[i] == a[1]) {
            if (!queue)
              queue = true, puts("pushQueue");
            else
              puts("pushFront");
          } else if (q[i] == a[2])
            puts("pushFront");
          else
            puts("pushBack");
        }
        puts("3 popStack popQueue popFront");
      }
    }
  }
  return 0;
}
