#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[50];
int b[50];
map<int, int> huan;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  sort(a, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (b[i] == a[1])
      printf("%d ", a[n]);
    else {
      for (int j = 1; j <= n; j++) {
        if (b[i] == a[j]) printf("%d ", a[j - 1]);
      }
    }
  }
  printf("\n");
  return 0;
}
