#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = 1e9;
const ll INF = 4e18;
const ll dy[4] = {1, 0, -1, 0};
const ll dx[4] = {0, -1, 0, 1};
int main() {
  ll N;
  cin >> N;
  vl A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  vector<pair<ll, ll>> vec(N);
  for (ll i = 0; i < N; i++) {
    vec.at(i).first = A.at(i);
    vec.at(i).second = i;
  }
  for (ll i = 0; i < N; i++) {
    vec.at(i).first = 0;
    sort((vec).begin(), (vec).end());
    cout << vec.at(N - 1).first << endl;
    for (ll i = 0; i < N; i++) {
      vec.at(i).first = A.at(i);
      vec.at(i).second = i;
    }
  }
}
