#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T GCD(T a, T b) {
  return b ? GCD(b, a % b) : a;
}
template <class T>
inline T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / GCD(a, b));
}
template <class T>
inline T POW1(T a, T b, T m) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > m) x %= m;
    }
    y = (y * y);
    if (y > m) y %= m;
    b /= 2;
  }
  return x;
}
template <class T>
inline T INV(T n, T m) {
  return POW1(n, m - 2, m);
}
template <class T>
inline T SUB(T a, T b, T m) {
  return (a % m - b % m + m) % m;
}
template <class T>
inline T ADD(T a, T b, T m) {
  return (a % m + b % m) % m;
}
template <class T>
inline T MUL(T a, T b, T m) {
  return (a % m * b % m) % m;
}
template <class T>
inline T DIV(T a, T b, T m) {
  return (a % m * (INV(b, m)) % m) % m;
}
int main() {
  long long int n;
  cin >> n;
  ;
  long long int a;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    ;
    if (a == 0) {
      vector<long long int> v1 = v;
      vector<long long int> s;
      sort(v1.begin(), v1.end(), greater<long long int>());
      for (long long int j = 0; j < 3; j++) {
        if (j == v1.size()) break;
        s.push_back(v1[j]);
      }
      long long int l = v.size();
      long long int fl = 0;
      long long int ss = s.size();
      for (long long int j = 0; j < l; j++) {
        long long int flg = 0;
        for (long long int k = 0; k < s.size(); k++) {
          if (s[k] == v[j]) {
            flg = 1;
            s[k] = -1000000007;
            break;
          }
        }
        if (flg == 1) {
          if (fl == 0)
            fl = 1;
          else if (fl == 1)
            fl = 2;
          else if (fl == 3)
            fl = 4;
        }
        if (fl == 0 || fl == 2) {
          cout << "pushStack\n";
          if (fl == 2) {
            fl = 3;
            continue;
          }
        } else if (fl == 1 || fl == 3) {
          cout << "pushQueue\n";
        } else if (fl == 4) {
          cout << "pushFront\n";
          fl = 1;
        }
      }
      cout << ss;
      if (ss == 1) cout << " popQueue";
      if (ss == 2) cout << " popQueue popStack";
      if (ss == 3) cout << " popQueue popStack popFront";
      cout << endl;
      v.clear();
    } else
      v.push_back(a);
  }
  for (long long int i = 0; i < v.size(); i++) cout << "pushStack\n";
  return 0;
}
