#include <bits/stdc++.h>
using namespace std;
int n, a[22], values[22];
int main() {
  while (scanf("%d", &n) > 0) {
    set<int> S;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      S.insert(a[i]);
    }
    if (S.size() < n) {
      printf("-1\n");
      continue;
    }
    n = 0;
    for (set<int>::iterator it = S.begin(); it != S.end(); it++) {
      values[n++] = *it;
    }
    for (int i = 0; i < n; i++) {
      int lo = 0, up = n - 1, j;
      while (lo <= up) {
        int mid = (lo + up) >> 1;
        if (values[mid] < a[i]) {
          lo = mid + 1;
        } else if (values[mid] > a[i]) {
          up = mid - 1;
        } else {
          j = mid;
          break;
        }
      }
      printf("%d%c", j + 1 == n ? values[0] : values[j + 1],
             i + 1 == n ? '\n' : ' ');
    }
  }
  return 0;
  n = 10;
  int a[] = {1, 2, 3, 1, 5, 6, 7, 8, 10, 99};
  int b[n];
  for (int i = 0; i < n; i++) b[i] = a[i];
  sort(b, b + n);
  bool test = false;
  do {
    test = true;
    for (int btm = 1; btm < (1 << n) - 1; btm++) {
      long long sum = 0;
      for (int i = 0; i < n; i++) {
        if (btm & (1 << i)) {
          sum += a[i] - b[i];
        }
      }
      if (!sum) {
        test = false;
        break;
      }
    }
  } while (next_permutation(b, b + n) and !test);
  printf("%d\n", test);
}
