#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  int d[200005];
  while (scanf("%d", &a) != EOF) {
    for (int i = 0; i < a; i++) {
      scanf("%d", &d[i]);
    }
    for (int i = 0; i < a; i++) {
      int t = 0;
      int s = d[i];
      d[i] = 0;
      for (int j = 0; j < a; j++) {
        if (d[j] > t) t = d[j];
      }
      printf("%d\n", t);
      d[i] = s;
    }
  }
}
