#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100001], temp[100001];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int st, q, d, j;
  st = q = d = 0;
  int h, m, l, flag = 0;
  h = m = l = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      flag = 0;
      cout << st + q + d;
      if (st != 0) cout << " popStack";
      if (q != 0) cout << " popQueue";
      if (d != 0) cout << " popFront";
      cout << endl;
      st = q = d = 0;
    }
    if (a[i] != 0 && flag == 0) {
      h = m = l = -1;
      j = 0;
      int k = i;
      while (a[k] != 0) temp[j++] = a[k++];
      sort(temp, temp + j);
      if (j >= 1) h = temp[j - 1];
      if (j >= 2) m = temp[j - 2];
      if (j >= 3) l = temp[j - 3];
      flag = 1;
    }
    if ((st == 0 && a[i] == l)) {
      cout << "pushStack\n";
      st = 1;
    } else if (q == 0 && a[i] == m) {
      cout << "pushQueue\n";
      q = 1;
    } else if ((d == 0 && a[i] == h)) {
      cout << "pushFront\n";
      d = 1;
    } else if (a[i] != 0)
      cout << "pushBack\n";
  }
  return 0;
}
