#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l, a[1000009], b[1000009], p[1000009], ans, cn, t, x, y, z,
    mx, mn, s;
int main() {
  while (scanf("%d", &n) != EOF) {
    cn = 0;
    for (i = 0; i < n; i++) {
      x = 0;
      scanf("%d", &a[cn]);
      if (a[cn] == 0) {
        x = 1;
      }
      b[cn] = a[cn];
      cn++;
      if ((a[cn - 1] != 0) && (i != n - 1)) {
        continue;
      } else {
        ans = 0;
        sort(b, b + cn);
        if (x == 0) {
          cn++;
        }
        for (j = 0; j < cn - 1; j++) {
          if (a[j] == b[cn - 1]) {
            ans++;
            printf("pushStack\n");
            b[cn - 1] = 0;
          } else if (a[j] == b[cn - 2]) {
            ans++;
            printf("pushQueue\n");
            b[cn - 2] = 0;
          } else if ((cn - 3 >= 0) && (a[j] == b[cn - 3])) {
            ans++;
            printf("pushFront\n");
            b[cn - 3] = 0;
          } else {
            printf("pushBack\n");
          }
        }
        cn = 0;
        if (x == 1) {
          printf("%d", ans);
          for (j = 0; j < ans; j++) {
            if (j == 0) {
              printf(" popStack");
            }
            if (j == 1) {
              printf(" popQueue");
            }
            if (j == 2) {
              printf(" popFront");
            }
          }
          printf("\n");
        }
      }
    }
  }
  return 0;
}
