#include <bits/stdc++.h>
using namespace std;
int N, A[100005];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int first = 0, last = 0;
  vector<int> s;
  while (first < N) {
    if (A[first] == 0) {
      int a = -1, b = -1, c = -1;
      sort(s.begin(), s.end());
      for (int i = 0; i < s.size(); i++) {
        if (A[last + i] == s[s.size() - 1]) {
          s[s.size() - 1] = -1;
          a = A[last + i];
          printf("pushStack\n");
        } else if (A[last + i] == s[s.size() - 2]) {
          s[s.size() - 2] = -1;
          b = A[last + i];
          printf("pushQueue\n");
        } else if (A[last + i] == s[s.size() - 3]) {
          s[s.size() - 3] = -1;
          c = A[last + i];
          printf("pushFront\n");
        } else {
          printf("pushBack\n");
        }
      }
      int cc = (a != -1) + (b != -1) + (c != -1);
      printf("%d", cc);
      if (a != -1) printf(" popStack");
      if (b != -1) printf(" popQueue");
      if (c != -1) printf(" popFront");
      printf("\n");
      last = first + 1;
      s.clear();
    } else {
      s.push_back(A[first]);
    }
    first++;
  }
  if (!s.empty()) {
    sort(s.begin(), s.end());
    for (int i = 0; i < s.size(); i++) {
      printf("pushBack\n");
    }
  }
}
