#include <bits/stdc++.h>
using namespace std;
inline int nxtint() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long nxtlong() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int old[25], Set[25];
int comparee(int i, int j) { return (old[i] < old[j]); }
int main() {
  int n;
  n = nxtint();
  for (int i = 0; i < n; i++) old[i] = nxtint(), Set[i] = i;
  sort(Set, Set + n, comparee);
  for (int i = 1; i < n; i++) swap(old[Set[i]], old[Set[i - 1]]);
  for (int i = 0; i < n; i++) cout << old[i] << " ";
  return 0;
}
