#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int query[n];
  int zero = 0;
  for (int i = 0; i < n; i++) {
    cin >> query[i];
    if (query[i] == 0) {
      zero++;
    }
  }
  vector<vector<int> > arr(zero + 1);
  int ind = 0;
  for (int i = 0; i < n; i++) {
    if (query[i] == 0) {
      ind++;
    } else {
      arr[ind].push_back(query[i]);
    }
  }
  bool cnt[zero + 1][3];
  for (int i = 0; i <= zero; i++) {
    sort(arr[i].begin(), arr[i].end());
    for (int j = 0; j < 3; j++) {
      cnt[i][j] = false;
    }
  }
  ind = 0;
  char *ans[3];
  ans[0] = (char *)"popStack";
  ans[1] = (char *)"popQueue";
  ans[2] = (char *)"popFront";
  for (int i = 0; i < n; i++) {
    if (query[i] == 0) {
      int x = arr[ind].size();
      x = min(x, 3);
      printf("%d", x);
      for (int j = 0; j < arr[ind].size() and j < 3; j++) {
        printf(" %s", ans[j]);
      }
      printf("\n");
      ind++;
    } else {
      int len = arr[ind].size();
      if (query[i] == arr[ind][len - 1] and cnt[ind][0] == false) {
        printf("pushStack\n");
        cnt[ind][0] = true;
      } else if (query[i] == arr[ind][len - 2] and cnt[ind][1] == false) {
        printf("pushQueue\n");
        cnt[ind][1] = true;
      } else if (query[i] == arr[ind][len - 3] and cnt[ind][2] == false) {
        printf("pushFront\n");
        cnt[ind][2] = true;
      } else {
        printf("pushBack\n");
      }
    }
  }
  return 0;
}
