#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = LONG_MAX;
const long long inf64 = LLONG_MAX;
const long double pi = 3.1415926535897932384626433832795;
bool cmp(const pair<int, int> a, const pair<int, int> b) {
  return a.first > b.first;
}
int a[100100];
int c[100100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++)
    if (a[i] != 0)
      v.push_back(make_pair(a[i], i));
    else {
      sort(v.begin(), v.end(), cmp);
      if (v.size() > 0) c[v[0].second] = 1;
      if (v.size() > 1) c[v[1].second] = 2;
      if (v.size() > 2) c[v[2].second] = 3;
      v.clear();
    }
  int count = 0;
  for (int i = 0; i < n; i++)
    if (a[i] != 0) {
      switch (c[i]) {
        case 0:
          printf("pushBack\n");
          break;
        case 1:
          printf("pushStack\n");
          break;
        case 2:
          printf("pushQueue\n");
          break;
        case 3:
          printf("pushFront\n");
          break;
      }
      count++;
    } else {
      if (count == 0) printf("0\n");
      if (count == 1) printf("1 popStack\n");
      if (count == 2) printf("2 popStack popQueue\n");
      if (count >= 3) printf("3 popStack popQueue popFront\n");
      count = 0;
    }
  return 0;
}
