#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[200000], tmp;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    tmp = a[i];
    a[i] = -1;
    sort(a, a + n);
    printf("%d\n", a[n - 1]);
    a[i] = tmp;
  }
  return 0;
}
