#include <bits/stdc++.h>
using namespace std;
vector<int> idx;
vector<pair<int, int> > pr;
int main() {
  int q, i = 0;
  cin >> q;
  while (q--) {
    int x;
    cin >> x;
    if (x) {
      pr.push_back({x, i});
      i++;
      idx.push_back(0);
    } else {
      sort(pr.begin(), pr.end());
      int sz = pr.size();
      for (int i = sz - 1; i >= 0; i--) {
        if (i == sz - 1) idx[pr[i].second] = 1;
        if (i == sz - 2) idx[pr[i].second] = 2;
        if (i == sz - 3) idx[pr[i].second] = 3;
      }
      for (int i = 0; i < sz; i++) {
        if (!idx[i])
          cout << "pushBack" << endl;
        else if (idx[i] == 1)
          cout << "pushStack" << endl;
        else if (idx[i] == 2)
          cout << "pushQueue" << endl;
        else if (idx[i] == 3)
          cout << "pushFront" << endl;
      }
      cout << min(sz, 3);
      if (sz) cout << " popStack";
      if (sz > 1) cout << " popQueue";
      if (sz > 2) cout << " popFront";
      cout << endl;
      pr.clear();
      i = 0;
      idx.clear();
    }
  }
  sort(pr.begin(), pr.end());
  int sz = pr.size();
  for (int i = sz - 1; i >= 0; i--) {
    if (i == sz - 1) idx[pr[i].second] = 1;
    if (i == sz - 2) idx[pr[i].second] = 2;
    if (i == sz - 3) idx[pr[i].second] = 3;
  }
  for (int i = 0; i < sz; i++) {
    if (!idx[i])
      cout << "pushBack" << endl;
    else if (idx[i] == 1)
      cout << "pushStack" << endl;
    else if (idx[i] == 2)
      cout << "pushQueue" << endl;
    else if (idx[i] == 3)
      cout << "pushFront" << endl;
  }
}
