#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[100000 + 10];
int n, ans[100000 + 10], opt[100000 + 10];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &opt[i]);
  for (int i = 0; i <= n; ++i)
    if (!opt[i]) {
      int nex = i + 1;
      for (; nex <= n + 1; ++nex)
        if (!opt[nex]) break;
      int cnt = 0;
      for (int j = i + 1; j < nex; ++j) arr[++cnt] = make_pair(opt[j], j);
      sort(arr + 1, arr + cnt + 1, greater<pair<int, int> >());
      if (!cnt)
        ans[nex] = 4;
      else if (cnt == 1)
        ans[arr[1].second] = 0, ans[nex] = 5;
      else if (cnt == 2)
        ans[arr[1].second] = 0, ans[arr[2].second] = 1, ans[nex] = 6;
      else {
        ans[arr[1].second] = 0;
        ans[arr[2].second] = 1;
        ans[arr[3].second] = 2;
        for (int j = 4; j <= n; ++j) ans[arr[j].second] = 3;
        ans[nex] = 7;
      }
    }
  for (int i = 1; i <= n; ++i) switch (ans[i]) {
      case 0:
        puts("pushStack");
        break;
      case 1:
        puts("pushQueue");
        break;
      case 2:
        puts("pushFront");
        break;
      case 3:
        puts("pushBack");
        break;
      case 4:
        puts("0");
        break;
      case 5:
        puts("1 popStack");
        break;
      case 6:
        puts("2 popStack popQueue");
        break;
      case 7:
        puts("3 popStack popQueue popFront");
        break;
    }
  return 0;
}
