#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> arr(n), tr(n);
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    tr[i] = arr[i];
  }
  sort(tr.begin(), tr.end());
  for (long long int i = 0; i < n; i++) {
    auto it = upper_bound(tr.begin(), tr.end(), arr[i]);
    if (it == tr.end())
      cout << tr[0] << " ";
    else
      cout << *it << " ";
  }
}
