#include <bits/stdc++.h>
using namespace std;
const int maxn = 23;
pair<int, int> pa[maxn];
int c[maxn];
int b[maxn];
map<int, int> mp, tf;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> pa[i].first;
    pa[i].second = i;
    c[i] = pa[i].first;
  }
  sort(pa + 1, pa + 1 + n);
  for (int i = 2; i <= n; i++) {
    mp[pa[i].second] = pa[i - 1].second;
  }
  mp[pa[1].second] = pa[n].second;
  for (int i = 1; i <= n; i++) {
    b[i] = c[mp[i]];
  }
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    if (mp[-b[i] + c[i]] == 1 || (n >= 2 && b[i] == c[i])) flag = 1;
    mp[-b[i] + c[i]]++;
  }
  if (flag == 1)
    cout << -1 << endl;
  else {
    for (int i = 1; i <= n; i++) cout << b[i] << " ";
  }
}
