#include <bits/stdc++.h>
using namespace std;
int n, m, c, l, r, s[1000];
int main() {
  cin >> n >> m >> c;
  int p;
  for (int i = 0; i < m && l + r < n; i++) {
    cin >> p;
    if (p <= c / 2) {
      int ind = 0;
      for (; ind < l && s[ind] <= p; ind++)
        ;
      s[ind] = p;
      l = max(l, ind + 1);
      cout << ind + 1 << endl;
    } else {
      int ind = n - 1;
      for (; ind > n - 1 - r && s[ind] >= p; ind--)
        ;
      s[ind] = p;
      r = max(r, n - ind);
      cout << ind + 1 << endl;
    }
  }
}
