#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  B = A;
  for (int j = 0; j < N; j++) {
    A[j] = 0;
    sort(A.begin(), A.end());
    cout << A[N - 1] << endl;
    A = B;
  }
}
