#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    int num = a[i];
    a.erase(a.begin() + i);
    sort(a.begin(), a.end(), greater<int>());
    cout << a[0] << endl;
    a.insert(a.begin() + i, num);
  }
  return 0;
}
