#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, A[200000], l, i = 0, m;
  cin >> n;
  while (cin >> l) {
    A[i] = l;
    i++;
  }
  for (int j = 0; j < n; j++) {
    m = 0;
    for (int k = 0; k < n; k++) {
      if (j != k) {
        if (A[k] > m) {
          m = A[k];
        }
      }
    }
    cout << m << endl;
  }
}
