#include <bits/stdc++.h>
using namespace std;
int a[1000000];
bool us[1000000];
int q[3];
const string push[3] = {"pushStack", "pushQueue", "pushBack"};
const string pop[3] = {"popStack", "popQueue", "popBack"};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  set<pair<int, int>> st;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> b = {-1};
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) b.push_back(i);
  }
  for (int i = 0; i + 1 < b.size(); i++) {
    vector<pair<int, int>> z;
    for (int j = b[i] + 1; j < b[i + 1]; j++) z.push_back({a[j], j});
    sort((z).begin(), (z).end());
    for (int j = 0; j < 3 && j < z.size(); j++)
      us[z[(int)z.size() - j - 1].second] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      vector<string> ans;
      for (int j = 0; j < 3; j++) {
        if (q[j] > 0) {
          ans.push_back(pop[j]);
          q[j]--;
        }
      }
      cout << ans.size();
      if (!ans.empty()) cout << " ";
      for (int j = 0; j < ans.size(); j++) {
        if (j != 0) cout << " ";
        cout << ans[j];
      }
    } else {
      if (us[i]) {
        int id = 0;
        for (int j = 1; j < 3; j++)
          if (q[j] < q[id]) id = j;
        q[id]++;
        cout << push[id];
      } else {
        cout << "pushFront";
      }
    }
    if (i + 1 != n) cout << '\n';
  }
  return 0;
}
