#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, x;
string a[4] = {"pushStack", "pushQueue", "pushFront", "pushBack"},
       b[4] = {"popStack", "popQueue", "popFront", "popBack"};
vector<int> v;
void solve() {
  if (v.size() <= 3) {
    for (int i = 0; i < v.size(); i++) cout << a[i] << endl;
    cout << v.size();
    for (int i = 0; i < v.size(); i++) cout << " " << b[i];
    cout << endl;
  } else {
    int mx[4] = {-1, -1, -1, 0};
    for (int i = 0; i < v.size(); i++)
      if (v[i] > mx[0]) {
        mx[0] = v[i];
        sort(mx, mx + 3);
      }
    for (int i = 0; i < v.size(); i++) {
      for (int j = 0; j < 4; j++)
        if (j == 3 || v[i] == mx[j]) {
          cout << a[j] << endl;
          mx[j] = -1;
          break;
        }
    }
    cout << 3;
    for (int i = 0; i < 3; i++) cout << " " << b[i];
    cout << endl;
  }
  v.clear();
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x)
      v.push_back(x);
    else
      solve();
  }
  for (int i = 0; i < v.size(); i++) cout << "pushBack\n";
  return 0;
}
