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