#include <bits/stdc++.h>
using namespace std;
void max(vector<int> num, int n) {
  static int i = 0;
  num.erase(num.begin() + i);
  int max = *max_element(num.begin(), (num.begin() + n));
  cout << max << endl;
  ++i;
}
int main() {
  int n;
  cin >> n;
  vector<int> num(n);
  for (int i = 0; i < n; ++i) cin >> num.at(i);
  for (int i = 0; i < n; ++i) max(num, n);
}
