#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
stringstream output;
inline void eOP();
inline void no() {
  output.str(string());
  output << -1;
  eOP();
}
int main() {
  int n;
  cin >> n;
  set<int> nums;
  int* a = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (nums.count(a[i])) {
      no();
    }
    nums.insert(a[i]);
  }
  vector<int> b;
  for (auto it = (nums).begin(); it != (nums).end(); ++it) {
    b.push_back(*it);
  }
  map<int, int> m;
  for (int i = 0; i < n; ++i) {
    m[b[i]] = b[(i + 1) % n];
  }
  for (int i = 0; i < n; ++i) {
    output << m[a[i]] << " ";
  }
  eOP();
}
inline void eOP() {
  cout << output.str();
  output.str(string());
  exit(0);
}
