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