#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, t;
  cin >> n;
  vector<long long> a(n);
  vector<long long> a2(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    a2[i] = a[i];
  }
  for (long long i = 0; i < n; i++) {
    t = a2[i];
    a2[i] = 0;
    sort(a2.begin(), a2.end());
    cout << a2[n - 1] << endl;
    a2 = a;
  }
}
