#include <bits/stdc++.h>
int n;
int num[25];
int rk[25];
using namespace std;
struct A {
  int a;
  int pos;
} a[25];
bool cmp(A x, A y) { return x.a < y.a; }
bool cmp2(A x, A y) { return x.pos < y.pos; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].a);
    a[i].pos = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    num[i] = a[i].a;
    rk[a[i].pos] = i;
  }
  sort(a + 1, a + n + 1, cmp2);
  for (int i = 1; i <= n; i++) {
    if (rk[i] != n)
      printf("%d ", num[rk[i] + 1]);
    else
      printf("%d ", num[1]);
  }
  printf("\n");
  return 0;
}
