#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    int max = 0;
    int tmp = A.at(i);
    A.at(i) = 0;
    for (int j = 0; j < N; j++) {
      if (max < A.at(j)) {
        max = A.at(j);
      }
    }
    A.at(i) = tmp;
    cout << max << endl;
  }
  return 0;
}
