#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvs = vector<vs>;
using vvb = vector<vb>;
using vvpi = vector<vpi>;
void setIO(string name = "") {
  cin.tie(nullptr)->sync_with_stdio(false);
  if ((int)(name).size()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
const vs pops = {"popStack", "popFront", "popQueue", "popBack"};
const vs pushes = {"pushStack", "pushFront", "pushQueue", "pushBack"};
int main() {
  setIO("");
  int N, n;
  cin >> N;
  while (N) {
    vi a, top(3, 0);
    while (N > 0) {
      N--;
      cin >> n;
      a.push_back(n);
      if (n == 0) break;
      if (n >= top[0]) {
        swap(top[2], top[1]);
        swap(top[1], top[0]);
        top[0] = n;
      } else if (n >= top[1]) {
        swap(top[2], top[1]);
        top[1] = n;
      } else if (n > top[2]) {
        top[2] = n;
      }
    }
    int i = 0;
    for (auto& x : a) {
      auto it = find(begin(top), end(top), x);
      if (x == 0) {
        cout << i;
        while (i > 0 && i--) cout << " " << pops[i];
        cout << "\n";
      } else if (i < 3 && it != top.end()) {
        cout << pushes[i++] << "\n";
        top.erase(it);
      } else
        cout << pushes[3] << "\n";
    }
  }
}
