#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void PLAY() {
  cout << fixed << setprecision(10);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  PLAY();
  int n;
  cin >> n;
  vector<int> v(n), a(n), res(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  a = v;
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    if (v[i] == a[0])
      res[i] = a.back();
    else {
      for (int j = 0; j < n; j++)
        if (v[i] == a[j]) {
          res[i] = a[j - 1];
          break;
        }
    }
  }
  for (auto e : res) cout << e << " ";
  return 0;
}
