#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int i = 0;
  priority_queue<pair<int, int> > pq;
  stack<int> st;
  deque<int> dq;
  queue<int> Q;
  while (n--) {
    int x;
    cin >> x;
    if (x) {
      pq.push({x, i++});
    } else {
      i = 0;
      if (((int)((pq).size())) >= 3) {
        vector<string> op(((int)((pq).size())));
        op[pq.top().second] = "pushStack";
        st.push(pq.top().first);
        pq.pop();
        op[pq.top().second] = "pushQueue";
        Q.push(pq.top().first);
        pq.pop();
        op[pq.top().second] = "pushFront";
        dq.push_front(pq.top().first);
        pq.pop();
        while (!pq.empty())
          op[pq.top().second] = "pushBack", dq.push_back(pq.top().first),
          pq.pop();
        for (auto i = 0; i < (long long)(((int)((op).size()))); i++)
          cout << op[i] << '\n';
        cout << "3 popStack popQueue popFront" << '\n';
        st.pop(), Q.pop(), dq.pop_front();
      } else {
        if (pq.empty())
          cout << 0 << '\n';
        else if (((int)((pq).size())) == 1) {
          cout << "pushStack\n1 popStack\n";
          while (!pq.empty()) pq.pop();
        } else if (((int)((pq).size())) == 2) {
          cout << "pushStack\npushQueue\n2 popStack popQueue\n";
          while (!pq.empty()) pq.pop();
        } else {
          vector<string> ret(((int)((pq).size())));
          ret[pq.top().second] = "pushStack";
          pq.pop();
          ret[pq.top().second] = "pushQueue";
          pq.pop();
          ret[pq.top().second] = "pushFront";
          pq.pop();
          while (!pq.empty()) {
            ret[pq.top().second] = "pushBack";
            pq.pop();
          }
          for (auto i = 0; i < (long long)(((int)((ret).size()))); i++)
            cout << ret[i] << '\n';
          cout << "3 popStack popQueue popBack\n";
        }
      }
    }
  }
  while (!pq.empty()) {
    cout << "pushBack\n";
    pq.pop();
  }
  return 0;
}
