#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> &v) {
  if (((int)(v).size()) == 0) {
    puts("0");
  } else if (((int)(v).size()) == 1) {
    puts("pushStack");
    puts("1 popStack");
  } else if (((int)(v).size()) == 2) {
    puts("pushStack");
    puts("pushQueue");
    puts("2 popStack popQueue");
  } else {
    int a[3] = {};
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
      if (*it >= a[0]) {
        a[2] = a[1];
        a[1] = a[0];
        a[0] = *it;
      } else if (*it >= a[1]) {
        a[2] = a[1];
        a[1] = *it;
      } else if (*it >= a[2]) {
        a[2] = *it;
      }
    }
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
      if (*it == a[0]) {
        a[0] = -1;
        puts("pushStack");
      } else if (*it == a[1]) {
        a[1] = -1;
        puts("pushQueue");
      } else if (*it == a[2]) {
        a[2] = -1;
        puts("pushFront");
      } else {
        puts("pushBack");
      }
    }
    puts("3 popStack popQueue popFront");
  }
  v.clear();
}
int n, op[100010];
int main() {
  scanf("%d", &(n));
  for (int i = 0; i < (n); i++) scanf("%d", &(op[i]));
  vector<int> v;
  for (int i = 0; i < (n); i++) {
    if (op[i] == 0)
      solve(v);
    else
      v.push_back(op[i]);
  }
  for (int i = 0; i < (((int)(v).size())); i++) puts("pushStack");
  return 0;
}
