#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  stringstream ss;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  bool choose[n];
  for (int i = 0; i < n; i++) choose[i] = 0;
  auto cmp = [&](int i, int j) { return a[i] < a[j]; };
  priority_queue<int, vector<int>, decltype(cmp)> pq(cmp);
  for (int i = 0; i < n; i++)
    if (!a[i]) {
      int num = 3;
      while (pq.size()) {
        if (num-- > 0) choose[pq.top()] = 1;
        pq.pop();
      }
    } else
      pq.push(i);
  int r = 0;
  int c[] = {0, 0, 0};
  string cmd[] = {"Stack", "Queue", "Front"};
  for (int i = 0; i < n; i++)
    if (a[i]) {
      if (choose[i]) {
        c[r]++;
        ss << "push" << cmd[r++] << endl;
        r %= 3;
      } else
        ss << "pushBack" << endl;
    } else {
      int x = 0;
      for (int t = 0; t < 3; t++) x += c[t] ? 1 : 0;
      ss << x;
      for (int t = 0; t < 3; t++)
        if (c[t]) {
          c[t]--;
          ss << " "
             << "pop" << cmd[t];
        }
      ss << endl;
    }
  cout << ss.str();
  return 0;
}
