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