#include <bits/stdc++.h>
using namespace std;
int n;
int a[100000];
int mas[3];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 0;
  while (i < n) {
    mas[0] = mas[1] = mas[2] = 0;
    int j = i;
    while (i < n && a[i] > 0) {
      int t;
      int num = a[i];
      if (num > mas[0]) {
        t = num;
        num = mas[0];
        mas[0] = t;
      }
      if (num > mas[1]) {
        t = num;
        num = mas[1];
        mas[1] = t;
      }
      if (num > mas[2]) {
        t = num;
        num = mas[2];
        mas[2] = t;
      }
      i++;
    }
    if (i < n) {
      if (j == i)
        cout << "0\n";
      else {
        while (j < i) {
          if (a[j] == mas[0]) {
            cout << "pushStack\n";
            a[j] = mas[0] = -1;
          }
          if (a[j] == mas[1]) {
            cout << "pushQueue\n";
            a[j] = mas[1] = -2;
          }
          if (a[j] == mas[2]) {
            cout << "pushFront\n";
            a[j] = mas[2] = -3;
          }
          if (a[j] > 0) {
            cout << "pushBack\n";
          }
          j++;
        }
        int k = 0;
        if (mas[0] < 0) k++;
        if (mas[1] < 0) k++;
        if (mas[2] < 0) k++;
        cout << k;
        if (mas[0] < 0) cout << " popStack";
        if (mas[1] < 0) cout << " popQueue";
        if (mas[2] < 0) cout << " popFront";
        cout << '\n';
      }
    } else {
      while (j < i) {
        cout << "pushBack\n";
        j++;
      }
    }
    i++;
  }
  return 0;
}
