#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool smax(T &a, const T &b) {
  if (a > b) return false;
  a = b;
  return true;
}
template <typename T>
bool smin(T &a, const T &b) {
  if (a < b) return false;
  a = b;
  return true;
}
template <typename T>
T cd(T a, T b) {
  return (a + b - 1) / b;
}
void build() {}
void solve() {
  int n;
  cin >> n;
  vector<int> v;
  v.resize(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  ;
  vector<int> tmp = v;
  sort(tmp.begin(), tmp.end());
  for (auto i : v) {
    if (i == tmp.back())
      cout << tmp[0] << " ";
    else {
      auto it = find(tmp.begin(), tmp.end(), i);
      cout << *(it + 1) << " ";
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  build();
  solve();
  return 0;
}
