#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long N = 2e5 + 7;
const long long mod = 1e9 + 7;
long long a[N], b[N], used[N][6], n;
vector<long long> vc;
void rec(long long ind, long long x) {
  if (used[ind][x]) {
    return;
  }
  if (ind == n) {
    for (auto i : vc) {
      cout << i << ' ';
    }
    exit(0);
  }
  for (long long i = 1; i <= 5; i++) {
    long long ok = 0;
    if (a[ind + 1] > a[ind] && i > x) {
      ok = 1;
    } else if (a[ind + 1] < a[ind] && i < x) {
      ok = 1;
    } else if (a[ind + 1] == a[ind] && i != x) {
      ok = 1;
    }
    if (ok) {
      vc.push_back(i);
      rec(ind + 1, i);
      vc.pop_back();
    }
  }
  used[ind][x] = 1;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= 5; i++) {
    vc.push_back(i);
    rec(1, i);
    vc.pop_back();
  }
  cout << -1;
}
