#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int p[n + 1];
  int q[n + 1];
  vector<int> v;
  v.push_back(0);
  int flag1 = 0;
  int flag2 = 0;
  int flag3 = 0;
  p[0] = 0;
  q[0] = 0;
  for (int i = 1; i < n + 1; i++) {
    cin >> p[i];
    q[i] = p[i];
    if (p[i] == 0) {
      v.push_back(i);
    }
  }
  v.push_back(n + 1);
  int x;
  int k = 0;
  int a, b, c;
  for (int i = 0; i < v.size() - 1; i++) {
    x = v[i + 1] - v[i] - 1;
    if (i > 0) {
      if (k == 0) {
        cout << "0\n";
      } else if (k == 1) {
        k = 0;
        cout << "1 popStack\n";
      } else if (k == 2) {
        k = 0;
        cout << "2 popStack popQueue\n";
      } else if (k >= 3) {
        k = 0;
        cout << "3 popStack popQueue popBack\n";
      }
    }
    if (x == 1) {
      cout << "pushStack\n";
      k++;
      continue;
    }
    if (x == 2) {
      cout << "pushStack\n";
      cout << "pushQueue\n";
      k += 2;
      continue;
    }
    if (x == 3) {
      cout << "pushStack\n";
      cout << "pushQueue\n";
      cout << "pushBack\n";
      k += 3;
      continue;
    }
    if (x > 3) {
      sort(q + v[i], q + v[i] + x + 1);
      a = q[v[i] + x];
      b = q[v[i] + x - 1];
      c = q[v[i] + x - 2];
      int d = q[v[i] + x - 3];
      for (int j = v[i] + 1; j < v[i + 1]; j++) {
        k++;
        if (p[j] == a && flag1 == 0) {
          cout << "pushStack\n";
          flag1++;
          continue;
        } else if (p[j] == b && flag2 == 0) {
          cout << "pushQueue\n";
          flag2++;
          continue;
        } else if (p[j] == c && flag3 == 0) {
          cout << "pushBack\n";
          flag3++;
          continue;
        } else {
          cout << "pushFront\n";
        }
      }
    }
    flag1 = 0;
    flag2 = 0;
    flag3 = 0;
  }
  return 0;
}
