#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int> > q;
int a[100005], S, Q, F, t, n;
bool f[100005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i])
      q.push(make_pair(a[i], i));
    else {
      for (int t = 1; t <= 3 && !q.empty(); t++)
        f[(q.top()).second] = 1, q.pop();
      while (!q.empty()) q.pop();
    }
  }
  for (int i = 1; i <= n; i++)
    if (!a[i]) {
      printf("%d", (S > 0) + (Q > 0) + (F > 0));
      if (S) printf(" popStack"), S = 0;
      if (Q) printf(" popQueue"), Q = 0;
      if (F) printf(" popBack"), F = 0;
      putchar('\n');
    } else if (f[i]) {
      if (t % 3 == 0) puts("pushStack"), S++;
      if (t % 3 == 1) puts("pushQueue"), Q++;
      if (t++ % 3 == 2) puts("pushBack"), F++;
    } else
      puts("pushFront"), F++;
  return 0;
}
