#include <bits/stdc++.h>
using namespace std;
int max(int a[], int n) {
  int max = a[0];
  for (int i = 1; i < n; i++) {
    if (max < a[i]) max = a[i];
  }
  return max;
}
int main() {
  int N, i, j;
  cin >> N;
  int A[N], B[N];
  for (i = 0; i < N; i++) cin >> A[i];
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) B[j] = A[j];
    B[i] = 0;
    cout << max(B, N) << endl;
  }
  return 0;
}
