#include <bits/stdc++.h>
struct heap {
  int heapsize;
  int arr[100009];
};
void max_heapify(struct heap *c, int i, int *array) {
  if (c->heapsize == 0) return;
  int smallest, tmp;
  if (((2 * i) <= c->heapsize) && (array[c->arr[2 * i]] > array[c->arr[i]]))
    smallest = 2 * i;
  else
    smallest = i;
  if (((2 * i + 1) <= c->heapsize) &&
      (array[c->arr[2 * i + 1]] > array[c->arr[smallest]]))
    smallest = 2 * i + 1;
  if (smallest == i) return;
  tmp = c->arr[i];
  c->arr[i] = c->arr[smallest];
  c->arr[smallest] = tmp;
  max_heapify(c, smallest, array);
  return;
};
int extract_max(struct heap *c, int *array) {
  if (c->heapsize == 0) return 0;
  int max;
  max = c->arr[1];
  c->arr[1] = c->arr[c->heapsize];
  (c->heapsize)--;
  max_heapify(c, 1, array);
  return max;
};
void insert(struct heap *c, int *array, int key) {
  int tmp;
  c->heapsize = c->heapsize + 1;
  c->arr[c->heapsize] = key;
  int j = c->heapsize;
  while (j > 1) {
    if (array[c->arr[j]] > array[c->arr[j / 2]]) {
      tmp = c->arr[j];
      c->arr[j] = c->arr[j / 2];
      c->arr[j / 2] = tmp;
      j = j / 2;
    } else
      return;
  }
  return;
};
int main() {
  int n, i, j, tmp;
  scanf("%d", &n);
  int array[n + 5];
  struct heap aux;
  aux.heapsize = 0;
  char a[n + 5];
  for (i = 1; i <= n; i++) {
    scanf("%d", &array[i]);
    a[i] = 48;
  }
  for (i = 1; i <= n; i++) {
    if (array[i] != 0) {
      insert(&aux, array, i);
    } else if (array[i] == 0) {
      j = 3;
      while (j--) {
        tmp = extract_max(&aux, array);
        if (tmp > 0) a[tmp] = 49;
      }
      aux.heapsize = 0;
    }
  }
  int count = 0;
  for (i = 1; i <= n; i++) {
    if (array[i] > 0 && a[i] == 49) {
      count = count + 1;
      if (count % 3 == 1)
        printf("pushStack\n");
      else if (count % 3 == 2)
        printf("pushQueue\n");
      else if (count % 3 == 0)
        printf("pushFront\n");
    } else if (array[i] > 0 && a[i] == 48)
      printf("pushBack\n");
    else if (array[i] == 0) {
      if (count == 0)
        printf("0\n");
      else if (count == 1) {
        printf("1 popStack\n");
        count = count - 1;
      } else if (count == 2) {
        printf("2 popStack popQueue\n");
        count = count - 2;
      } else if (count >= 3) {
        printf("3 popStack popQueue popFront\n");
        count = count - 3;
      }
    }
  }
  return 0;
}
