#include <bits/stdc++.h>
using namespace std;
int n;
priority_queue<pair<int, int> > qu;
vector<int> v;
int main() {
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    if (!x) {
      if (qu.empty()) {
        puts("0");
        continue;
      }
      if (qu.size() == 1) {
        puts("pushStack");
        puts("1 popStack");
      } else if (qu.size() == 2) {
        puts("pushStack");
        puts("pushQueue");
        puts("2 popStack popQueue");
      } else {
        int at[3];
        for (int i = 0; i < 3; ++i) {
          at[i] = qu.top().second;
          qu.pop();
        }
        sort(at, at + 3);
        for (int i = 0; i <= at[0]; ++i) puts("pushStack");
        for (int i = at[0] + 1; i <= at[1]; ++i) puts("pushFront");
        for (int i = at[1] + 1; i < at[2]; ++i) puts("pushBack");
        for (int i = at[2]; i < v.size(); ++i) puts("pushQueue");
        puts("3 popStack popQueue popFront");
      }
      while (!qu.empty()) qu.pop();
      v.clear();
    } else {
      qu.push(make_pair(x, v.size()));
      v.push_back(x);
    }
  }
  for (size_t i = 0; i < v.size(); ++i) puts("pushStack");
  return 0;
}
