#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> num(N);
  vector<int> cop(N);
  for (int i = 0; i < N; i++) {
    cin >> num.at(i);
    cop.at(i) = num.at(i);
  }
  for (int j = 0; j < N; j++) {
    cop.at(j) = 0;
    sort(cop.begin(), cop.end());
    reverse(cop.begin(), cop.end());
    cout << cop.at(0) << endl;
    for (int k = 0; k < N; k++) {
      cop.at(k) = num.at(k);
    }
  }
}
