#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  auto itr = A.begin();
  for (int n = 0; n < N; n++) {
    cin >> A.at(n);
  }
  vector<int> A_cpy(N);
  copy(A.begin(), A.end(), A_cpy.begin());
  for (int i = 0; i < N; i++) {
    int tmp = A.at(i);
    A.at(i) = 0;
    sort(A.begin(), A.end());
    cout << A.at(N - 1) << endl;
    copy(A_cpy.begin(), A_cpy.end(), A.begin());
    A.at(i) = tmp;
  }
}
