#include <bits/stdc++.h>
using namespace std;
long long sum_1 = 0, sum_2 = 0;
int a[25], b[25], c[25];
bool compare(int a, int b) { return a > b; }
int main() {
  int n;
  int temp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    temp = a[i];
    for (int j = 0; j < n; j++) {
      if (temp == b[j]) {
        if (j > 0) {
          c[i] = b[j - 1];
        } else if (j == 0) {
          c[i] = b[n - 1];
        }
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", c[i]);
  }
  return 0;
}
