#include <bits/stdc++.h>
using namespace std;
const int N = 22;
int n, a[N];
pair<int, int> b[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    b[i] = {a[i], i};
  }
  sort(b, b + n);
  for (int i = 0; i < n; ++i) {
    if (i + 1 < n && b[i].first == b[i + 1].first) {
      printf("-1");
      return 0;
    }
    a[b[i].second] = b[(i + 1) % n].first;
  }
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
  return 0;
}
