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