#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, com, i, st, f1 = 0, f2 = 0, f3 = 0;
  cin >> n;
  vector<long long int> arr, arr1;
  while (n--) {
    scanf("%lld", &com);
    if (com != 0) {
      arr.push_back(com);
      arr1.push_back(com);
    } else {
      sort(arr1.rbegin(), arr1.rend());
      for (i = 0; i < arr.size(); ++i) {
        if (arr[i] == arr1[0] && !f1)
          puts("pushStack"), f1 = 1;
        else if (arr[i] == arr1[1] && f2 == 0)
          puts("pushQueue"), f2 = 1;
        else if (arr[i] == arr1[2] && f3 == 0)
          puts("pushFront"), f3 = 1;
        else
          puts("pushBack");
      }
      if (arr.size() == 0)
        puts("0");
      else if (arr.size() == 1)
        cout << "1 popStack" << endl;
      else if (arr.size() == 2)
        cout << "2 popStack popQueue" << endl;
      else
        cout << "3 popStack popQueue popFront" << endl;
      arr.clear();
      arr1.clear();
      f1 = f2 = f3 = 0;
    }
  }
  if (arr.size() != 0) {
    sort(arr1.rbegin(), arr1.rend());
    for (i = 0; i < arr.size(); ++i) {
      if (arr[i] == arr1[0] && f1 == 0)
        puts("pushStack"), f1 = 1;
      else if (arr[i] == arr1[1] && f2 == 0)
        puts("pushQueue"), f2 = 1;
      else if (arr[i] == arr1[2] && f3 == 0)
        puts("pushFront"), f3 = 1;
      else
        puts("pushBack");
    }
  }
}
