#include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<int> d;
vector<string> op;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  op.push_back("Stack");
  op.push_back("Queue");
  op.push_back("Back");
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a == 0) {
      sort(v.begin(), v.end(), greater<int>());
      string print = "";
      stringstream yy;
      yy << min(3, (int)v.size());
      for (int j = 0; j < min(3, (int)v.size()); j++) {
        yy << " "
           << "pop" << op[j];
      }
      print = yy.str();
      v.push_back(1e9);
      v.push_back(1e9);
      v.push_back(1e9);
      v.push_back(1e9);
      for (int j = 0; j < d.size(); j++) {
        if (d[j] == v[0]) {
          cout << "push" << op[0] << endl;
          v[0] = 1e9;
        } else if (d[j] == v[1]) {
          cout << "push" << op[1] << endl;
          v[1] = 1e9;
        } else if (d[j] == v[2]) {
          cout << "push" << op[2] << endl;
          v[2] = 1e9;
        } else {
          cout << "pushFront" << endl;
        }
      }
      cout << print << endl;
      v.clear();
      d.clear();
    } else {
      v.push_back(a);
      d.push_back(a);
    }
  }
  for (int j = 0; j < d.size(); j++) {
    cout << "pushFront" << endl;
  }
  return 0;
}
