#include <bits/stdc++.h>
using namespace std;
const int maxn = 30;
struct Node {
  int pos, val;
  bool operator<(const Node& a) const { return val < a.val; }
} p[maxn];
int ans[maxn];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> p[i].val, p[i].pos = i;
  sort(p + 1, p + n + 1);
  for (int i = 2; i <= n; ++i) ans[p[i].pos] = p[i - 1].val;
  ans[p[1].pos] = p[n].val;
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
