#include <bits/stdc++.h>
int main(void) {
  int a, i, h, j, x[200000], max;
  scanf("%d", &a);
  int b[a];
  for (i = 0; i < a; i++) {
    scanf("%d", &b[i]);
  }
  for (i = 0; i < a; i++) {
    for (h = 0; h < a; h++) x[h] = 0;
    for (h = 0; h < a; h++) x[h] = b[h];
    x[i] = 0;
    max = x[0];
    for (h = 0; h < a; h++) {
      if (x[h] >= max) max = x[h];
    }
    printf("%d\n", max);
  }
  return 0;
}
