#include <bits/stdc++.h>
struct P {
  int val, id;
  int operator<(const P& t) const { return val < t.val; }
} a[22];
int n, i, res[22];
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; ++i) scanf("%d", &a[i].val), a[i].id = i;
  std::sort(a, a + n);
  for (i = 1; i < n; ++i) res[a[i].id] = a[i - 1].val;
  res[a[0].id] = a[n - 1].val;
  for (i = 0; i < n; ++i) printf("%d ", res[i]);
}
