#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long powmod(long long a, long long b, long long MOD) {
  long long ans = 1;
  while (b) {
    if (b % 2) ans = ans * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return ans;
}
const int N = 2e3 + 32;
int n, a[N], b[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], b[i] = a[i];
  sort(b + 1, b + 1 + n);
  for (int i = 1; i <= n; i++) {
    int pos = upper_bound(b + 1, b + 1 + n, a[i]) - b;
    if (pos == 1 + n)
      cout << b[1] << ' ';
    else
      cout << b[pos] << ' ';
  }
  return 0;
}
