#include <bits/stdc++.h>
using namespace std;
long long n, cr;
bool f = 0;
pair<long long, long long> a[25], b[25], c[25];
void gen(long long i, long long s1, long long s2) {
  if (i == n) {
    if (s1 != s2) cr++;
  } else {
    gen(i + 1, s1 + a[i].first, s2 + c[i].first);
    gen(i + 1, s1, s2);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
    c[i] = a[i];
  }
  sort(a, a + n);
  sort(c, c + n);
  for (long long k = 0; k < n; k++) {
    for (long long i = 0; i < n; i++) {
      b[i] = a[i];
    }
    a[0] = b[n - 1];
    for (long long i = 1; i < n; i++) {
      a[i] = b[i - 1];
    }
    cr = 0;
    gen(0, 0, 0);
    if (cr == ((1 << n) - 2)) {
      f = 1;
      for (long long i = 0; i < n; i++) {
        c[i].first = c[i].second;
        c[i].second = a[i].first;
      }
      break;
    }
  }
  if (!f) {
    cout << -1;
    return 0;
  }
  sort(c, c + n);
  for (long long i = 0; i < n; i++) {
    cout << c[i].second << " ";
  }
  return 0;
}
