#include <bits/stdc++.h>
using namespace std;
int sta[100050], que[100050], dp[100050], n[3], pri[100050];
int main() {
  int i, m[3], nn, j, k;
  while (cin >> nn) {
    for (i = 0; i < nn; i++) cin >> pri[i];
    m[0] = m[1] = m[2] = -1;
    int last = -1;
    for (i = 0; i < nn; i++) {
      if (pri[i] == 0) {
        if (m[0] > m[1]) swap(m[0], m[1]);
        if (m[1] > m[2]) swap(m[1], m[2]);
        if (m[0] > m[1]) swap(m[0], m[1]);
        if (i - last - 1 == 0) {
          cout << 0 << endl;
          last = i;
          continue;
        }
        for (j = last + 1; j < i; j++) {
          if (j != m[0] && j != m[1] && j != m[2]) {
            cout << "pushBack" << endl;
            n[2]++;
          } else if (j == m[0]) {
            cout << "pushQueue" << endl;
            n[0]++;
          } else if (j == m[1]) {
            cout << "pushStack" << endl;
            n[1]++;
          } else if (j == m[2]) {
            cout << "pushFront" << endl;
            n[2]++;
          }
        }
        int index = 0;
        for (j = 0; j < 3; j++)
          if (n[j]) index++;
        printf("%d", index);
        if (n[0]) cout << " popQueue";
        if (n[1]) cout << " popStack";
        if (n[2]) cout << " popFront";
        cout << endl;
        last = i;
        m[0] = m[1] = m[2] = -1;
        n[0] = n[1] = n[2] = 0;
        continue;
      }
      for (j = 0; j < 3; j++) {
        if (m[j] == -1 || pri[i] >= pri[m[j]]) {
          for (k = 2; k > j; k--) {
            m[k] = m[k - 1];
          }
          m[j] = i;
          break;
        }
      }
    }
    if (last != nn - 1) {
      if (m[0] > m[1]) swap(m[0], m[1]);
      if (m[1] > m[2]) swap(m[1], m[2]);
      if (m[0] > m[1]) swap(m[0], m[1]);
      for (j = last + 1; j < i; j++) {
        if (j != m[0] && j != m[1] && j != m[2]) {
          cout << "pushBack" << endl;
          n[2]++;
        } else if (j == m[0]) {
          cout << "pushQueue" << endl;
          n[0]++;
        } else if (j == m[1]) {
          cout << "pushStack" << endl;
          n[1]++;
        } else if (j == m[2]) {
          cout << "pushFront" << endl;
          n[2]++;
        }
      }
      continue;
    }
  }
  return 0;
}
