func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void dbg_vector(const T& v) {     for (size_t i = 0; i < v.size(); ++i) cout << v[i] <<    ;     cout << endl;   }   void dbg() { cerr << endl; }   template <typename Head, typename... Tail>   void dbg(Head H, Tail... T) {     cerr << H <<    ;     dbg(T...);   }   struct pair_hash {     template <class T1, class T2>     size_t operator()(const pair<T1, T2>& p) const {       auto h1 = std::hash<T1>{}(p.first);       auto h2 = std::hash<T2>{}(p.second);       return h1 ^ h2;     }   };   struct Comparator {     template <class T1, class T2>     bool operator()(const std::pair<T1, T2>& lhs,                     const std::pair<T1, T2>& rhs) const {       if (lhs.first == rhs.first)         return lhs.second < rhs.second;       else         return lhs.first < rhs.first;     }   };   inline long long lmin(long long a, long long b) {     if (a < b) return a;     return b;   }   inline long long lmax(long long a, long long b) {     if (a > b) return a;     return b;   }   long long INF = 1e18;   long long MOD = 998244353;   struct edge {     long long w, x, y;     edge(){};     edge(long long w, long long x, long long y) : w(w), x(x), y(y){};   };   struct EdgeComparator {     bool operator()(const edge& lhs, const edge& rhs) const {       if (lhs.w < rhs.w) return true;       return false;     }   };   vector<int> prefix_function(string& s) {     int n = s.size();     vector<int> p(n);     for (int i = 1; i < n; ++i) {       int j = p[i - 1];       while (s[i] != s[j] && j > 0) j = p[j - 1];       if (s[i] == s[j]) j++;       p[i] = j;     }     return p;   }   vector<long long> matmul(vector<long long>& a, vector<long long>& b) {     vector<long long> res(4);     res[0] = (a[0] * b[0] + a[1] * b[2]) % MOD;     res[1] = (a[0] * b[1] + a[1] * b[3]) % MOD;     res[2] = (a[2] * b[0] + a[3] * b[2]) % MOD;     res[3] = (a[2] * b[1] + a[3] * b[3]) % MOD;     return res;   }   vector<long long> matpow(vector<long long>& m, long long n) {     if (n == 1) return m;     if (n % 2 == 0) {       vector<long long> a = matpow(m, n >> 1);       return matmul(a, a);     } else {       vector<long long> a = matpow(m, n - 1);       return matmul(a, m);     }   }   struct point {     int x, y;     point(){};     point(int x, int y) : x(x), y(y){};   };   struct rect {     int x1, y1, x2, y2;     rect(){};     rect(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2){};   };   bool cw(point& a, point& b) {     int cross_product = a.x * b.y - a.y * b.x;     return cross_product <= 0;   }   bool oneline(point& a, point& b) {     int cross_product = a.x * b.y - a.y * b.x;     return cross_product == 0;   }   int main() {     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; ++i) cin >> a[i];     vector<vector<bool> > can(n, vector<bool>(5));     vector<vector<int> > p(n, vector<int>(5));     can[0][0] = true;     can[0][1] = true;     can[0][2] = true;     can[0][3] = true;     can[0][4] = true;     for (int i = 1; i < n; ++i) {       if (a[i] == a[i - 1]) {         for (int k = 0; k <= 4; ++k) {           for (int j = 0; j <= 4; ++j) {             if (j != k && can[i - 1][j]) {               can[i][k] = true;               p[i][k] = j;               break;             }           }         }       } else if (a[i] > a[i - 1]) {         if (can[i - 1][0]) {           can[i][1] = true;           p[i][1] = 0;           can[i][2] = true;           p[i][2] = 0;           can[i][3] = true;           p[i][3] = 0;           can[i][4] = true;           p[i][4] = 0;         } else if (can[i - 1][1]) {           can[i][2] = true;           p[i][2] = 1;           can[i][3] = true;           p[i][3] = 1;           can[i][4] = true;           p[i][4] = 1;         } else if (can[i - 1][2]) {           can[i][3] = true;           p[i][3] = 2;           can[i][4] = true;           p[i][4] = 2;         } else if (can[i - 1][3]) {           can[i][4] = true;           p[i][4] = 3;         } else {           cout << -1 << endl;           return 0;         }       } else {         if (can[i - 1][4]) {           can[i][0] = true;           p[i][0] = 4;           can[i][1] = true;           p[i][1] = 4;           can[i][2] = true;           p[i][2] = 4;           can[i][3] = true;           p[i][3] = 4;         } else if (can[i - 1][3]) {           can[i][0] = true;           p[i][0] = 3;           can[i][1] = true;           p[i][1] = 3;           can[i][2] = true;           p[i][2] = 3;         } else if (can[i - 1][2]) {           can[i][0] = true;           p[i][0] = 2;           can[i][1] = true;           p[i][1] = 2;         } else if (can[i - 1][1]) {           can[i][0] = true;           p[i][0] = 1;         } else {           cout << -1 << endl;           return 0;         }       }     }     vector<int> ans(n);     if (can[n - 1][0]) {       int i = n - 1;       int cur = 0;       ans[n - 1] = cur + 1;       while (i > 0) {         cur = p[i][cur];         ans[i - 1] = cur + 1;         i--;       }     } else if (can[n - 1][1]) {       int i = n - 1;       int cur = 1;       ans[n - 1] = cur + 1;       while (i > 0) {         cur = p[i][cur];         ans[i - 1] = cur + 1;         i--;       }     } else if (can[n - 1][2]) {       int i = n - 1;       int cur = 2;       ans[n - 1] = cur + 1;       while (i > 0) {         cur = p[i][cur];         ans[i - 1] = cur + 1;         i--;       }     } else if (can[n - 1][3]) {       int i = n - 1;       int cur = 3;       ans[n - 1] = cur + 1;       while (i > 0) {         cur = p[i][cur];         ans[i - 1] = cur + 1;         i--;       }     } else if (can[n - 1][4]) {       int i = n - 1;       int cur = 4;       ans[n - 1] = cur + 1;       while (i > 0) {         cur = p[i][cur];         ans[i - 1] = cur + 1;         i--;       }     }     for (int i = 0; i < n; ++i) cout << ans[i] <<    ;     cout << endl;   }   