#include <bits/stdc++.h>
using namespace std;
int a[100001], n;
int max1 = 0, max2 = 0, max3 = 0;
void change_maxes(int x) {
  if (x > max1) {
    max3 = max2;
    max2 = max1;
    max1 = x;
  } else if (x > max2) {
    max3 = max2;
    max2 = x;
  } else if (x > max3)
    max3 = x;
}
int main() {
  cin >> n;
  int count = 0;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 0) {
      bool b1 = 0, b2 = 0, b3 = 0;
      for (int j = 0; j < count; j++) {
        if (a[j] == max1 && !b1) {
          printf("pushStack\n");
          b1 = 1;
        } else if (a[j] == max2 && !b2) {
          printf("pushQueue\n");
          b2 = 1;
        } else if (a[j] == max3 && !b3) {
          printf("pushFront\n");
          b3 = 1;
        } else
          printf("pushBack\n");
      }
      res += (max1 + max2 + max3);
      int num = 3;
      if (max1 == 0) num--;
      if (max2 == 0) num--;
      if (max3 == 0) num--;
      if (num == 0)
        printf("0\n");
      else if (num == 1)
        printf("1 popStack\n");
      else if (num == 2)
        printf("2 popStack popQueue\n");
      else
        printf("3 popStack popQueue popFront\n");
      max1 = max2 = max3 = 0;
      count = 0;
    } else {
      change_maxes(x);
      a[count++] = x;
    }
  }
  bool b1 = 0, b2 = 0, b3 = 0;
  for (int j = 0; j < count; j++) {
    if (a[j] == max1 && !b1) {
      printf("pushStack\n");
      b1 = 1;
    } else if (a[j] == max2 && !b2) {
      printf("pushQueue\n");
      b2 = 1;
    } else if (a[j] == max3 && !b3) {
      printf("pushFront\n");
      b3 = 1;
    } else
      printf("pushBack\n");
  }
  return 0;
}
