#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int An[200000];
  int max;
  if (scanf("%d", &n) != EOF) {
    int hmax[n];
    if (2 <= n && n <= 200000) {
      for (int a = 0; a < n; a++) {
        cin >> An[a];
      }
      for (int b = 0; b < n; b++) {
        max = An[b];
        for (int c = 0; (c + 1) < n; c++) {
          if (max < An[b]) {
            max = An[b];
          }
        }
        hmax[n - 1 - b] = max;
      }
      for (int d = 0; d < n; d++) {
        cout << hmax[d] << endl;
      }
    }
  }
}
