#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> res;
  vector<int> seq;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    if (tmp) {
      seq.push_back(tmp);
    }
    bool end_reached = (n - 1) == i;
    if (0 == tmp || end_reached) {
      if (0 == tmp && seq.empty()) {
        res.push_back("0");
        continue;
      }
      auto sorted_seq = seq;
      sort(sorted_seq.begin(), sorted_seq.end(), greater<int>());
      int mx0 = sorted_seq.size() > 0 ? sorted_seq[0] : -1;
      int mx1 = sorted_seq.size() > 1 ? sorted_seq[1] : -1;
      int mx2 = sorted_seq.size() > 2 ? sorted_seq[2] : -1;
      int qu = 0, st = 0, de = 0;
      for (auto x : seq) {
        if (x == mx0 && !qu) {
          qu = x;
          res.push_back("pushQueue");
        } else if (x == mx1 && !st) {
          st = x;
          res.push_back("pushStack");
        } else if (x == mx2 && !de) {
          de = x;
          res.push_back("pushFront");
        } else {
          res.push_back("pushBack");
        }
      }
      if (end_reached && 0 != tmp) {
        break;
      }
      if (qu && st && de) {
        res.push_back("3 popQueue popStack popFront");
      } else if (qu && st) {
        res.push_back("2 popQueue popStack");
      } else if (qu) {
        res.push_back("1 popQueue");
      }
      seq.clear();
    }
  }
  for (auto x : res) {
    cout << x << endl;
  }
  return 0;
}
