#include <bits/stdc++.h>
using namespace std;
int n, a[101010];
struct node {
  int val, id;
  node() {}
  node(int _val, int _id) { val = _val, id = _id; }
  friend bool operator<(node a, node b) { return a.val < b.val; }
};
priority_queue<node> pq;
int vis[101010];
int main() {
  int i, j, cnt;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    while (!pq.empty()) pq.pop();
    memset(vis, -1, sizeof(vis));
    for (i = 0; i <= n; i++) {
      if (a[i] == 0) {
        node tmp;
        for (cnt = j = 0; j < 3; j++) {
          if (pq.empty()) break;
          tmp = pq.top();
          pq.pop();
          vis[tmp.id] = j + 1;
          cnt++;
        }
        vis[i] = cnt;
        while (!pq.empty()) pq.pop();
      } else
        pq.push(node(a[i], i));
    }
    for (i = 0; i < n; i++) {
      if (a[i] == 0) {
        if (vis[i] == 0)
          puts("0");
        else if (vis[i] == 1)
          puts("1 popStack");
        else if (vis[i] == 2)
          puts("2 popStack popQueue");
        else
          puts("3 popStack popQueue popFront");
      } else if (vis[i] == -1)
        puts("pushBack");
      else {
        if (vis[i] == 1)
          puts("pushStack");
        else if (vis[i] == 2)
          puts("pushQueue");
        else
          puts("pushFront");
      }
    }
  }
}
