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