#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, c = 1;
  cin >> a;
  int b[a];
  for (int i = 0; i < a; i++) cin >> b[i];
  if (a == 2) {
    cout << max(b[0], b[1]) << endl;
    cout << max(b[0], b[1]) << endl;
    return 0;
  }
  for (int i = 0; i < a; i++) {
    for (int j = c; j < a; j++) {
      cout << max(b[i], b[j]) << endl;
    }
    c++;
  }
}
