#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int a[n];
  int first = -100;
  int second = 10000000;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    first = max(first, a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != first) second = min(second, first - a[i]);
  }
  second = first - second;
  if (second < 0) second = first;
  for (int i = 0; i < n; i++) {
    if (a[i] != first)
      cout << first << endl;
    else
      cout << second << endl;
  }
  return 0;
}
