#include <bits/stdc++.h>
const int MAX = 100005;
int a[MAX], b[MAX], Max1, Max2, Max3, id1, id2, id3, Min, id;
int main() {
  int n, num;
  while (~scanf("%d", &n)) {
    memset(b, 0, sizeof(b));
    Max1 = Max2 = Max3 = 0;
    id1 = id2 = id3 = 0;
    num = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      if (a[i] == 0) {
        b[i] = num;
        b[id1] = 1;
        b[id2] = 2;
        b[id3] = 3;
        Max1 = Max2 = Max3 = 0;
        id1 = id2 = id3 = 0;
        num = 0;
      } else {
        num++;
        if (num == 1) {
          Max1 = a[i];
          id1 = i;
        } else if (num == 2) {
          Max2 = a[i];
          id2 = i;
        } else if (num == 3) {
          Max3 = a[i];
          id3 = i;
        } else if (num > 3) {
          Min = a[i];
          id = i;
          if (Min > Max1) {
            Min = Max1;
            id = id1;
          }
          if (Min > Max2) {
            Min = Max2;
            id = id2;
          }
          if (Min > Max3) {
            Min = Max3;
            id = id3;
          }
          if (Min == Max1) {
            Max1 = a[i];
            id1 = i;
          } else if (Min == Max2) {
            Max2 = a[i];
            id2 = i;
          } else if (Min == Max3) {
            Max3 = a[i];
            id3 = i;
          }
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      if (a[i] == 0) {
        if (b[i] == 0)
          printf("0\n");
        else {
          if (b[i] <= 3)
            printf("%d", b[i]);
          else
            printf("3");
          if (b[i] >= 1) printf(" popStack");
          if (b[i] >= 2) printf(" popQueue");
          if (b[i] >= 3) printf(" popFront");
          printf("\n");
        }
      } else {
        if (b[i] == 1)
          printf("pushStack\n");
        else if (b[i] == 2)
          printf("pushQueue\n");
        else if (b[i] == 3)
          printf("pushFront\n");
        else
          printf("pushBack\n");
      }
    }
  }
  return 0;
}
