#include <bits/stdc++.h>
using namespace std;
vector<int> V, temp;
int main() {
  int n, val;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &val);
    if (val == 0 && V.size() == 0) {
      puts("0");
      continue;
    }
    if (val == 0) {
      bool flag_v, flag_s;
      flag_v = flag_s = false;
      temp = V;
      sort(temp.begin(), temp.end());
      int len = V.size(), cnt = 0;
      if (len >= 1) cnt++;
      if (len >= 2) cnt++;
      if (len >= 3) cnt++;
      for (int j = 0; j < len; j++) {
        if (!flag_v && len >= 1 && V[j] == temp[len - 1]) {
          puts("pushQueue");
          flag_v = true;
        } else if (!flag_s && len >= 2 && V[j] == temp[len - 2]) {
          puts("pushStack");
          flag_s = true;
        } else if (len >= 3 && V[j] == temp[len - 3])
          puts("pushFront");
        else
          puts("pushBack");
      }
      printf("%d ", cnt);
      if (cnt == 1)
        puts("popQueue");
      else if (cnt == 2)
        puts("popQueue popStack");
      else if (cnt == 3)
        puts("popQueue popStack popFront");
      V.clear(), temp.clear();
    } else
      V.push_back(val);
  }
  if (V.size() != 0) {
    bool flag_v, flag_s;
    flag_v = flag_s = false;
    temp = V;
    sort(temp.begin(), temp.end());
    int len = V.size();
    for (int j = 0; j < len; j++) {
      if (!flag_v && len >= 1 && V[j] == temp[len - 1]) {
        puts("pushQueue");
        flag_v = true;
      } else if (!flag_s && len >= 2 && V[j] == temp[len - 2]) {
        puts("pushStack");
        flag_s = true;
      } else if (len >= 3 && V[j] == temp[len - 3])
        puts("pushFront");
      else
        puts("pushBack");
    }
  }
  return 0;
}
