#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &ai : a) cin >> ai;
  vector<pair<int, int>> v;
  vector<bool> b(n);
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      sort(begin(v), end(v));
      for (int k = 0; k < 3; k++)
        if (!v.empty()) {
          b[v.back().second] = true, v.pop_back();
        }
      v.clear();
    } else {
      v.emplace_back(a[i], i);
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      cout << cnt;
      if (1 <= cnt) cout << " popStack";
      if (2 <= cnt) cout << " popQueue";
      if (3 <= cnt) cout << " popFront";
      cout << endl;
      cnt = 0;
    } else {
      if (b[i]) {
        cnt++;
        if (cnt == 1) cout << "pushStack" << endl;
        if (cnt == 2) cout << "pushQueue" << endl;
        if (cnt == 3) cout << "pushFront" << endl;
      } else {
        cout << "pushBack" << endl;
      }
    }
  }
  return 0;
}
