#include <bits/stdc++.h>
using namespace std;
int Max(int n, int a[]) {
  int max = 0;
  for (int i = 0; i < n; i++) {
    if (max < a[i]) max = a[i];
  }
  return max;
}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int ans, temp;
    temp = a[i];
    a[i] = 0;
    cout << Max(n, a) << endl;
    a[i] = temp;
  }
}
