#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> V(n);
  for (int k = 0; k < n; k++) {
    cin >> V.at(k);
  }
  int maxN = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j) {
        maxN = max(maxN, V.at(j));
      }
    }
    cout << maxN << endl;
    maxN = 0;
  }
}
