#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
int main() {
  ll n;
  cin >> n;
  vll a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  ll get;
  vll x(n);
  for (int i = 0; i < (int)(n); i++) x[i] = a[i];
  for (int i = 0; i < (int)(n); i++) {
    get = a[i];
    a.erase(a.begin() + i);
    sort(a.begin(), a.end());
    cout << a[n - 1] << endl;
    for (int i = 0; i < (int)(n); i++) a[i] = x[i];
  }
}
