#include <bits/stdc++.h>
using namespace std;
long long getAns(vector<long long> &arr, vector<long long> &brr,
                 vector<vector<long long>> &dp, long long i, long long prev) {
  if (i == arr.size()) {
    for (auto x : brr) {
      cout << x << " ";
    }
    exit(0);
  }
  if (dp[i][prev] != -1) {
    return dp[i][prev];
  }
  if (arr[i - 1] < arr[i]) {
    for (long long k = prev + 1; k <= 5; k++) {
      brr.push_back(k);
      getAns(arr, brr, dp, i + 1, k);
      brr.pop_back();
    }
  } else if (arr[i - 1] > arr[i]) {
    for (int k = prev - 1; k >= 1; k--) {
      brr.push_back(k);
      getAns(arr, brr, dp, i + 1, k);
      brr.pop_back();
    }
  } else if (arr[i - 1] == arr[i]) {
    for (int k = 1; k <= 5; k++) {
      if (prev == k) {
        continue;
      }
      brr.push_back(k);
      getAns(arr, brr, dp, i + 1, k);
      brr.pop_back();
    }
  }
  return dp[i][prev] = 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> arr, brr;
  for (int i = 0; i < n; i++) {
    long long val;
    cin >> val;
    arr.push_back(val);
  }
  vector<vector<long long>> dp;
  for (int i = 0; i <= n; i++) {
    vector<long long> temp(6, -1);
    dp.push_back(temp);
  }
  for (int k = 1; k <= 5; k++) {
    brr.push_back(k);
    getAns(arr, brr, dp, 1, k);
    brr.pop_back();
  }
  cout << -1 << endl;
  return 0;
}
