#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i], b[i] = i;
  sort(b.begin(), b.end(), [&a](int x, int y) { return a[x] < a[y]; });
  for (int i = 1; i < n; ++i) swap(a[b[i - 1]], a[b[i]]);
  for (auto x : a) cout << x << " ";
}
