#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int i = 0; i < N; ++i) {
    int hoge;
    B = A;
    B[i] = 0;
    sort(B.begin(), B.end());
    cout << B[N - 1] << endl;
  }
}
