#include <bits/stdc++.h>
using namespace std;
int vis[100005];
int mat[100005];
int slv(int size) {
  for (int i = 0; i < size; i++) vis[i] = 0;
  int cnt = 1;
  for (int j = 0; j < 3; j++) {
    int idx = -1;
    for (int i = 0; i < size; i++)
      if ((idx == -1 || mat[idx] < mat[i]) && !vis[i]) idx = i;
    if (idx != -1) vis[idx] = cnt++;
  }
  return cnt;
}
int main() {
  int n;
  cin >> n;
  int ptr = 0;
  for (int i = 0; i < n; i++) {
    int ord;
    cin >> ord;
    if (ord != 0)
      mat[ptr++] = ord;
    else if (ord == 0) {
      int mysol = slv(ptr) - 1;
      for (int out = 0; out < ptr; out++)
        if (!vis[out])
          cout << "pushBack\n";
        else if (vis[out] == 1)
          cout << "pushFront\n";
        else if (vis[out] == 2)
          cout << "pushStack\n";
        else
          cout << "pushQueue\n";
      cout << mysol;
      for (int out = 0; out < ptr; out++)
        if (vis[out] == 1)
          cout << " popFront";
        else if (vis[out] == 2)
          cout << " popStack";
        else if (vis[out] == 3)
          cout << " popQueue";
      cout << endl;
      ptr = 0;
    }
  }
  if (ptr != 0) {
    for (int out = 0; out < ptr; out++) cout << "pushBack\n";
  }
}
