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