#include <bits/stdc++.h>
using namespace std;
long long a[33], b[33];
map<int, int> m;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    m[a[i]] = i;
  }
  int ans1 = 1, ans2 = 1;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] < a[i + 1]) ans1++;
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] > a[i + 1]) ans2++;
  }
  if (ans1 == n || ans2 == n) {
    for (int i = 1; i < n; i++) printf("%d ", a[i]);
    printf("%d\n", a[0]);
  } else {
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      b[m[a[(i + 1) % n]]] = a[i];
    }
    for (int i = 0; i < n; i++) {
      if (i == n)
        cout << b[i] << endl;
      else
        cout << b[i] << " ";
    }
  }
}
