#include <bits/stdc++.h>
using namespace std;
ifstream fin("abc.in");
vector<long> v;
string str[] = {" popQueue", " popStack", " popFront"};
long n, i, x, mx[3], j;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x != 0) {
      v.push_back(x);
      if (x > mx[2]) {
        mx[0] = mx[1];
        mx[1] = mx[2];
        mx[2] = x;
      } else if (x > mx[1]) {
        mx[0] = mx[1];
        mx[1] = x;
      } else if (x > mx[0])
        mx[0] = x;
    } else {
      int cnt = 3;
      if (mx[0] == 0) cnt--;
      if (mx[1] == 0) cnt--;
      if (mx[2] == 0) cnt--;
      for (j = 0; j < v.size(); j++) {
        if (v[j] == mx[0]) {
          cout << "pushFront\n";
          mx[0] = 0;
        } else if (v[j] == mx[1]) {
          cout << "pushStack\n";
          mx[1] = 0;
        } else if (v[j] == mx[2]) {
          cout << "pushQueue\n";
          mx[2] = 0;
        } else
          cout << "pushBack\n";
      }
      cout << cnt;
      for (j = 0; j < cnt; j++) cout << str[j];
      if (i != n) cout << '\n';
      v.clear();
    }
  }
  if (v.size() != 0)
    for (i = 1; i <= v.size(); i++) cout << "pushBack\n";
}
