#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int max = 0;
  int ary[N];
  for (int i = 0; i < N; i++) {
    cin >> ary[i];
  }
  for (int i = 0; i < N; i++) {
    max = 0;
    for (int j = 0; j < N; j++) {
      if (i == j) continue;
      if (ary[j] > max) max = ary[j];
    }
    cout << max << endl;
  }
}
