#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  ;
  vector<int> a(n), tmp;
  for (int i = 0; i < n; scanf("%d", &a[i++]))
    ;
  string out[] = {"popStack", "popQueue", "popBack"};
  for (int i = 0; i < n; i++) {
    int j = i;
    vector<int> tmp;
    while (j < n && a[j]) tmp.push_back(a[j]), j++;
    sort(tmp.rbegin(), tmp.rend());
    bool s = 0, q = 0, d = 0;
    while (i < n && a[i]) {
      if (tmp.size() && !s && a[i] == tmp[0])
        cout << "pushStack\n", s = 1;
      else if (tmp.size() > 1 && !q && a[i] == tmp[1])
        cout << "pushQueue\n", q = 1;
      else if (tmp.size() > 2 && !d && a[i] == tmp[2])
        cout << "pushBack\n", d = 1;
      else
        cout << "pushFront\n";
      i++;
    }
    if (i < n) {
      cout << s + q + d;
      for (int i = 0; i < s + q + d; i++) cout << ' ' << out[i];
      cout << endl;
    }
  }
  return 0;
}
