#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int n;
  cin >> n;
  long long int a[n], up = 0;
  set<long long int> mp;
  set<long long int>::iterator it;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    up = max(a[i], up), mp.insert(a[i]);
  }
  for (long long int i = 0; i < n; i++) {
    if (a[i] == up)
      cout << *mp.begin() << " ";
    else {
      it = mp.upper_bound(a[i]);
      cout << *it << " ";
    }
  }
}
