#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k[n];
  for (int i = 0; i < n; ++i) {
    cin >> k[i];
  }
  int tempr = 0;
  for (int j = 0; j < n; ++j) {
    tempr = k[j];
    k[j] = 0;
    cout << *max_element(k, k + n) << endl;
    k[j] = tempr;
  }
  return 0;
}
