#include <bits/stdc++.h>
using namespace std;
int r, ans[200000], b[200000];
int main() {
  cin >> r;
  for (int i = 0; i < r; i++) cin >> ans[i];
  for (int i = 0; i < r; i++) {
    memcpy(b, ans, sizeof(ans));
    b[i] = 0;
    sort(b, b + r);
    cout << b[r - 1] << endl;
  }
}
