#include <bits/stdc++.h>
using namespace std;
int n, arr[100005];
int dp[100005][6];
bool y = 0;
vector<int> ans;
bool solve(int pos, int lastfinger) {
  if (pos == n) return 1;
  if (dp[pos][lastfinger] != -1) return dp[pos][lastfinger];
  if (arr[pos] < arr[pos - 1]) {
    for (int i = lastfinger - 1; i >= 1; i--) {
      ans.push_back(i);
      if (solve(pos + 1, i))
        return dp[pos][lastfinger] = 1;
      else
        ans.pop_back();
    }
  } else if (arr[pos] > arr[pos - 1]) {
    for (int i = lastfinger + 1; i <= 5; i++) {
      ans.push_back(i);
      if (solve(pos + 1, i))
        return dp[pos][lastfinger] = 1;
      else
        ans.pop_back();
    }
  } else {
    for (int i = 1; i <= 5; i++) {
      if (i != lastfinger) {
        ans.push_back(i);
        if (solve(pos + 1, i))
          return dp[pos][lastfinger] = 1;
        else
          ans.pop_back();
      }
    }
  }
  return dp[pos][lastfinger] = 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 1; i <= 5; i++) {
    ans.push_back(i);
    if (solve(1, i)) {
      y = 1;
      break;
    } else
      ans.pop_back();
  }
  if (y)
    for (auto i : ans) cout << i << ' ';
  else
    cout << -1;
  return 0;
}
