#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n;
pair<int, int> a[33];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  pair<int, int> b[33];
  for (int i = 0; i + 1 < n; i++) b[i] = a[i + 1];
  b[n - 1] = a[0];
  for (int mask = 1; mask + 1 < (1 << n); mask++) {
    int A = 0, B = 0;
    for (int i = 0; i < n; i++) {
      if ((1 << i) & mask) {
        A += a[i].first;
        B += b[i].first;
      }
    }
    if (A == B) {
      printf("-1\n");
      return 0;
    }
  }
  int ans[33];
  for (int i = 0; i < n; i++) {
    ans[a[i].second] = b[i].first;
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
  return 0;
}
