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