#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, an;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int j = 0; j < N; j++) {
    int max = 0;
    an = A.at(j);
    A.at(j) = 0;
    for (int k = 0; k < N; k++) {
      if (max < A.at(k)) max = A.at(k);
    }
    cout << max << endl;
    A.at(j) = an;
  }
}
