#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000,100000000000")
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
int a[100005], sz;
int p[100005];
bool cmp(int x, int y) { return a[x] > a[y]; }
int out[100005];
int arr[100005];
int main(void) {
  int n;
  scanf("%d", &n);
  for (long long(i) = 0; (i) < (long long)(n); (i)++) {
    scanf("%d", arr + i);
  }
  for (long long(i) = 0; (i) < (long long)(n); (i)++) {
    int value = arr[i];
    if (!value) {
      for (long long(j) = 0; (j) < (long long)(sz); (j)++) {
        p[j] = j;
        out[j] = 0;
      }
      sort(p, p + sz, cmp);
      int cnt = 0;
      for (long long(j) = 0; (j) < (long long)(sz); (j)++) {
        if (cnt < 3) {
          out[p[j]] = ++cnt;
        }
      }
      for (long long(j) = 0; (j) < (long long)(sz); (j)++) {
        if (out[j] == 1)
          printf("pushStack\n");
        else if (out[j] == 2)
          printf("pushQueue\n");
        else if (out[j] == 3)
          printf("pushFront\n");
        else
          printf("pushBack\n");
      }
      sz = 0;
      if (!cnt) {
        puts("0");
        continue;
      }
      printf("%d ", cnt);
      for (long long(j) = 0; (j) < (long long)(cnt); (j)++) {
        if (j == 0) printf("popStack");
        if (j == 1) printf("popQueue");
        if (j == 2) printf("popFront");
        if (j != cnt - 1) printf(" ");
      }
      printf("\n");
    } else {
      a[sz++] = value;
    }
  }
  if (arr[n - 1]) {
    for (long long(j) = 0; (j) < (long long)(sz); (j)++) {
      p[j] = j;
      out[j] = 0;
    }
    sort(p, p + sz, cmp);
    int cnt = 0;
    for (long long(j) = 0; (j) < (long long)(sz); (j)++) {
      if (cnt < 3) {
        out[p[j]] = ++cnt;
      }
    }
    for (long long(j) = 0; (j) < (long long)(sz); (j)++) {
      if (out[j] == 1)
        printf("pushStack\n");
      else if (out[j] == 2)
        printf("pushQueue\n");
      else if (out[j] == 3)
        printf("pushFront\n");
      else
        printf("pushBack\n");
    }
  }
  return 0;
}
