#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
int a[N];
bool dp[N][10];
int tr[N][10];
vector<int> ans;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (int)1; i <= (int)n; i++) cin >> a[i];
  for (int i = (int)1; i <= (int)5; i++) dp[1][i] = true;
  for (int i = (int)2; i <= (int)n; i++) {
    for (int cur = (int)1; cur <= (int)5; cur++) {
      for (int pre = (int)1; pre <= (int)5; pre++) {
        if (!dp[i - 1][pre]) continue;
        bool ok = false;
        if (a[i - 1] == a[i] && cur != pre) ok = true;
        if (a[i - 1] < a[i] && pre < cur) ok = true;
        if (a[i - 1] > a[i] && pre > cur) ok = true;
        if (ok) {
          dp[i][cur] = true;
          tr[i][cur] = pre;
        }
      }
    }
  }
  int cur = -1;
  for (int i = (int)1; i <= (int)5; i++) {
    if (dp[n][i]) {
      cur = i;
      break;
    }
  }
  if (cur == -1) {
    cout << -1 << '\n';
    return 0;
  }
  for (int i = (int)n; i >= (int)1; i--) {
    ans.push_back(cur);
    cur = tr[i][cur];
  }
  for (int i = (int)ans.size() - 1; i >= (int)0; i--) cout << ans[i] << ' ';
  cout << '\n';
}
