#include <bits/stdc++.h>
using namespace std;
string aS = "pushStack";
string aQ = "pushQueue";
string aF = "pushFront";
string aB = "pushBack";
string pS = "popStack";
string pQ = "popQueue";
string pF = "popFront";
string pB = "popBack";
int main() {
  ios_base::sync_with_stdio(false);
  int qq;
  cin >> qq;
  vector<int> ar;
  while (qq--) {
    int t;
    cin >> t;
    int d = 0;
    stack<int> s;
    queue<int> q;
    int _1 = 0, _2 = 0, _3 = 0;
    if (t == 0) {
      vector<int> x;
      x = ar;
      sort(x.rbegin(), x.rend());
      for (int i = 0; i < ar.size(); i++) {
        if (ar[i] == x[0] && !_1) {
          _1 = 1;
          if (q.empty()) {
            q.push(t);
            cout << aQ << "\n";
          } else if (s.empty()) {
            s.push(t);
            cout << aS << "\n";
          } else if (d == 0) {
            d = 1;
            cout << aB << "\n";
          } else {
            cout << aF << "\n";
          }
        } else if (ar.size() > 1 && ar[i] == x[1] && !_2) {
          _2 = 1;
          if (q.empty()) {
            q.push(t);
            cout << aQ << "\n";
          } else if (s.empty()) {
            s.push(t);
            cout << aS << "\n";
          } else if (d == 0) {
            d = 1;
            cout << aB << "\n";
          } else {
            cout << aF << "\n";
          }
        } else if (ar.size() > 2 && ar[i] == x[2] && !_3) {
          _3 = 1;
          if (q.empty()) {
            q.push(t);
            cout << aQ << "\n";
          } else if (s.empty()) {
            s.push(t);
            cout << aS << "\n";
          } else if (d == 0) {
            d = 1;
            cout << aB << "\n";
          } else {
            cout << aF << "\n";
          }
        } else {
          cout << aF << "\n";
        }
      }
      int cnt = 0;
      if (d != 0) cnt++;
      if (!s.empty()) cnt++;
      if (!q.empty()) cnt++;
      cout << cnt;
      if (!s.empty()) {
        cout << " " << pS;
      }
      if (!q.empty()) {
        cout << " " << pQ;
      }
      if (d) {
        cout << " " << pB;
      }
      cout << "\n";
      ar.clear();
    } else {
      ar.push_back(t);
    }
  }
  if (!ar.empty()) {
    for (int i = 0; i < ar.size(); i++) {
      cout << aB << "\n";
    }
  }
}
