#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  vector<int> B(n);
  int max = -1;
  int pos = -1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
      } else {
        if (A[j] > max) {
          max = A[j];
          pos = j;
        }
      }
    }
    B[i] = A[pos];
    max = -1;
    pos = -1;
  }
  for (int i = 0; i < n; i++) {
    cout << B[i] << endl;
  }
}
