#include <bits/stdc++.h>
using namespace std;
int v[200005], dp[200005][10], n;
int r[200005][10];
void construct(int i, int j) {
  while (i) {
    v[i] = j;
    j = r[i][j];
    --i;
  }
  for (int i = 1; i <= n; ++i) cout << v[i] << ' ';
  return;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  for (int i = 1; i <= 5; ++i) dp[1][i] = 1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= 5; ++j) {
      if (v[i] > v[i - 1]) {
        for (int k = 1; k <= 5; ++k) {
          if (j > k && dp[i - 1][k]) {
            dp[i][j] = 1;
            r[i][j] = k;
          }
        }
      }
      if (v[i] < v[i - 1]) {
        for (int k = 1; k <= 5; ++k) {
          if (j < k && dp[i - 1][k]) {
            dp[i][j] = 1;
            r[i][j] = k;
          }
        }
      }
      if (v[i] == v[i - 1]) {
        for (int k = 1; k <= 5; ++k) {
          if (j != k && dp[i - 1][k]) {
            dp[i][j] = 1;
            r[i][j] = k;
          }
        }
      }
    }
  }
  for (int i = 1; i <= 5; ++i) {
    if (dp[n][i]) {
      construct(n, i);
      return 0;
    }
  }
  cout << "-1";
  return 0;
}
