#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> kk;
  int n;
  cin >> n;
  int root;
  cin >> root;
  kk[1] = root;
  kk[root + 1] = root;
  for (int i = 1; i < n; i++) {
    int x;
    cin >> x;
    map<int, int>::iterator it = kk.upper_bound(x);
    it--;
    cout << it->second;
    if (i + 1 < n)
      cout << " ";
    else
      cout << endl;
    kk[it->first] = x;
    kk[x + 1] = x;
  }
  for (int i = 1; i < n; i++) {
  }
  return 0;
}
