#include <bits/stdc++.h>
using namespace std;
const long long int N = 2e5 + 5;
const long long int INF = 1e9 + 1;
bool check(long long int a, long long int b, long long int x, long long int y) {
  if (a < b) return x < y;
  if (a > b) return x > y;
  if (a == b) return x != y;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> a(n);
    for (long long int i = 0; i <= n; i++) {
      cin >> a[i];
    }
    vector<vector<long long int>> dp(n, vector<long long int>(5, 0));
    for (long long int i = 0; i < 5; i++) {
      dp[0][i] = 1;
    }
    for (long long int i = 1; i < n; i++) {
      for (long long int j = 0; j < 5; j++) {
        for (long long int q = 0; q < 5; q++) {
          if (check(a[i - 1], a[i], j, q) && dp[i - 1][j]) dp[i][q] = j + 1;
        }
      }
    }
    long long int cur = -1;
    for (long long int i = 0; i < 5; i++) {
      if (dp[n - 1][i] > 0) {
        cur = i;
      }
    }
    if (cur == -1) {
      cout << "-1";
      continue;
    }
    vector<long long int> ans;
    cur++;
    for (long long int i = n - 1; i >= 0; i--) {
      ans.push_back(cur);
      cur = dp[i][cur - 1];
    }
    for (long long int i = n - 1; i >= 0; i--) cout << ans[i] << " ";
  }
  return 0;
}
