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