#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e9;
const long long mx = 1e4;
void input() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  stack<int> s;
  queue<int> q;
  deque<int> d_q;
  int i = 0;
  while (i < n) {
    int j = i;
    while (i < n && a[i] != 0) ++i;
    if (i == n) {
      while (j++ < n)
        cout << "pushStack"
             << "\n";
    } else {
      if (i - j == 0) {
        cout << 0 << endl;
      } else if (i - j == 1) {
        cout << "pushStack" << endl;
        cout << 1 << " "
             << "popStack" << endl;
      } else if (i - j == 2) {
        cout << "pushStack" << endl << "pushQueue" << endl;
        cout << 2 << " "
             << "popStack"
             << " "
             << "popQueue" << endl;
      } else if (i - j == 3) {
        cout << "pushStack" << endl
             << "pushQueue"
             << "\n"
             << "pushFront" << endl;
        cout << 3 << " "
             << "popStack"
             << " "
             << "popQueue"
             << " "
             << "popFront" << endl;
      } else {
        int l = i - j;
        vector<int> ind(l);
        iota(ind.begin(), ind.end(), j);
        sort(ind.begin(), ind.end(),
             [&](const int p, const int q) { return a[p] > a[q]; });
        for (int k = j; k < i; ++k) {
          if (k == ind[0]) {
            s.push(a[k]);
            cout << "pushStack" << endl;
          } else if (k == ind[1]) {
            q.push(a[k]);
            cout << "pushQueue" << endl;
          } else if (k == ind[2]) {
            d_q.push_front(a[k]);
            cout << "pushFront" << endl;
          } else {
            d_q.push_back(a[k]);
            cout << "pushBack" << endl;
          }
        }
        cout << 3 << " "
             << "popStack"
             << " "
             << "popQueue"
             << " "
             << "popFront" << endl;
        while (!s.empty()) s.pop();
        while (!q.empty()) q.pop();
        d_q.clear();
      }
    }
    ++i;
  }
}
int main() {
  input();
  return 0;
}
