#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MSIZE = 3e5;
const long long base = 7;
const double EPS = 1e-9;
const int INF = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<int, int> > a(n);
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    mp[a[i].first]++;
    if (mp[a[i].first] > 1) {
      cout << -1;
      return 0;
    }
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  vector<int> b(n);
  for (int i = 0; i < n; ++i)
    if (i == 0)
      b[a[i].second] = a[n - 1].first;
    else
      b[a[i].second] = a[i - 1].first;
  for (int i = 0; i < n; ++i) cout << b[i] << " ";
  return 0;
}
