#include <bits/stdc++.h>   using namespace std;   struct data {     int idx, val;     bool operator<(const data &a1) const {       if (a1.val == val) {         return a1.idx < idx;       }       return val > a1.val;     }     data(int t, int w) : idx(t), val(w) {}   };   set<data> coastline;   set<data>::iterator it, it2;   int main() {     int N;     scanf( %d , &N);     string ans[N];     int a;     for (int i = 0; i < N; i++) {       scanf( %d , &a);       if (a == 0) {         int sz = coastline.size();         if (sz == 0) {           ans[i] =  0 ;         } else if (sz == 1) {           ans[i] =  1 popStack ;           it = coastline.begin();           ans[it->idx] =  pushStack ;         } else if (sz == 2) {           ans[i] =  2 popStack popQueue ;           it = coastline.begin();           ans[it->idx] =  pushQueue ;           it++;           ans[it->idx] =  pushStack ;           it++;         } else {           ans[i] =  3 popStack popQueue popFront ;           it = coastline.begin();           ans[it->idx] =  pushFront ;           it++;           ans[it->idx] =  pushQueue ;           it++;           ans[it->idx] =  pushStack ;           it++;         }         coastline.clear();       } else {         coastline.insert(data(i, a));       }     }     for (int i = 0; i < N; i++) {       if (ans[i].size() == 0) {         cout <<  pushBack  << endl;       } else         cout << ans[i] << endl;     }     return 0;   }   