#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[25];
int b[25];
int n;
int main() {
  while (cin >> n && n) {
    for (int i = (0), _end = (n - 1); i <= _end; ++i) {
      cin >> a[i].first;
      a[i].second = i;
    }
    sort(a, a + n);
    for (int i = (0), _end = (n - 1); i <= _end; ++i)
      b[a[i].second] = a[(i + 1) % n].first;
    for (int i = (0), _end = (n - 1); i <= _end; ++i)
      printf("%d%c", b[i], " \n"[i == n - 1]);
  }
  return 0;
}
