#include <bits/stdc++.h>
int main() {
  int n;
  bool isPossible = true;
  scanf("%d", &n);
  int a[n];
  std::set<int> multime;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (multime.find(a[i]) == multime.end())
      multime.insert(a[i]);
    else
      isPossible = false;
  }
  if (isPossible)
    for (int i = 0; i < n; i++) {
      auto it = multime.find(a[i]);
      it++;
      if (it == multime.end()) it = multime.begin();
      printf("%d ", *it);
    }
  else
    printf("-1");
  printf("\n");
  return 0;
}
