#include <bits/stdc++.h>
using namespace std;
const int N = 30;
int a[N], b[N];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; i++) {
    int f = a[i];
    int ind = 1;
    while (f != b[ind]) {
      ind++;
    }
    if (ind < n) {
      a[i] = b[ind + 1];
    } else {
      a[i] = b[1];
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
  return 0;
}
