#include <bits/stdc++.h>
using namespace std;
int Int() {
  int x;
  scanf("%d", &x);
  return x;
}
long long Long() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void err(istream_iterator<string> it) { cout << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ' ';
  err(++it, args...);
}
const int N = (int)1e5 + 5;
const int maxN = (int)1e6 + 6;
const long long Mod = (long long)1e9 + 7;
int dp[N][6], n, a[N];
vector<int> res;
bool call(int cur, int last) {
  if (cur == n) {
    return 1;
  }
  int& ret = dp[cur][last];
  if (~ret) return ret;
  ret = 0;
  if (a[cur] == a[cur - 1]) {
    for (int i = 1; i <= 5; ++i) {
      if (i != last) {
        res.push_back(i);
        if (call(cur + 1, i)) return ret = 1;
        res.pop_back();
      }
    }
  } else {
    int l, r;
    if (a[cur] > a[cur - 1])
      l = last + 1, r = 6;
    else
      l = 1, r = last;
    for (int i = l; i < r; ++i) {
      res.push_back(i);
      if (call(cur + 1, i)) return ret = 1;
      res.pop_back();
    }
  }
  return ret;
}
int main() {
  int test = 1, tc = 0;
  while (test--) {
    n = Int();
    for (int i = 0; i < n; ++i) {
      a[i] = Int();
    }
    memset(dp, -1, sizeof dp);
    for (int i = 1; i <= 5; ++i) {
      res.push_back(i);
      if (call(1, i)) {
        for (int i : res) cout << i << ' ';
        return 0;
      }
      res.pop_back();
    }
    puts("-1");
  }
  return 0;
}
