#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const long long INF = 1e9 + 5;
const long long mod = 1e9 + 7;
const double pi = 3.1415926536;
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
int n, arr[N], memo[N][6];
vector<int> ans;
int solve(int idx, int lastfinger) {
  if (idx == n) return 1;
  if (memo[idx][lastfinger] != -1) return memo[idx][lastfinger];
  if (arr[idx] == arr[idx - 1]) {
    for (int i = 1; i <= 5; i++) {
      if (i != lastfinger) {
        if (solve(idx + 1, i)) {
          ans.push_back(i);
          return memo[idx][i] = 1;
        }
      }
    }
  }
  if (arr[idx] < arr[idx - 1]) {
    for (int i = lastfinger - 1; i >= 1; i--) {
      if (solve(idx + 1, i)) {
        ans.push_back(i);
        return memo[idx + 1][i] = 1;
      }
    }
  }
  if (arr[idx] > arr[idx - 1]) {
    for (int i = lastfinger + 1; i <= 5; i++) {
      if (solve(idx + 1, i)) {
        ans.push_back(i);
        return memo[idx + 1][i] = 1;
      }
    }
  }
  return memo[idx][lastfinger] = 0;
}
void answer() {
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans[i] << " ";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  memset(memo, -1, sizeof memo);
  if (solve(1, 1)) {
    ans.push_back(1);
    answer();
  } else if (solve(1, 2)) {
    ans.push_back(2);
    answer();
  } else if (solve(1, 3)) {
    ans.push_back(3);
    answer();
  } else if (solve(1, 4)) {
    ans.push_back(4);
    answer();
  } else if (solve(1, 5)) {
    ans.push_back(5);
    answer();
  } else
    cout << "-1\n";
  return 0;
}
