#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const int maxn = 25;
int a[maxn];
int main() {
  int n = in();
  for (int i = 0; i < n; i++) a[i] = in();
  for (int i = 0; i < n; i++) {
    int x = -1;
    for (int j = 0; j < n; j++)
      if (a[j] < a[i] && (x == -1 || a[j] > a[x])) x = j;
    if (x == -1) {
      for (int j = 0; j < n; j++)
        if (x == -1 || a[j] > a[x]) x = j;
    }
    cout << a[x] << ' ';
  }
  cout << endl;
  return 0;
}
