#include <bits/stdc++.h>
int main() {
  int N, i, j;
  std::cin >> N;
  int Y[N];
  std::vector<int> X(N);
  for (i = 0; i < N; i++) {
    std::cin >> X[i];
  }
  for (i = 0; i < N; i++) {
    j = X[i];
    X[i] = 0;
    Y[i] = *std::max_element(X.begin(), X.end());
    X[i] = j;
    std::cout << Y[i] << std::endl;
  }
}
