#include <bits/stdc++.h>
using namespace std;
int a[10010];
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  while (m--) {
    int i, x;
    cin >> x;
    if (x * 2 > c)
      for (i = n; i >= 1 && a[i] && a[i] >= x; --i)
        ;
    else
      for (i = 1; i <= n && a[i] && a[i] <= x; ++i)
        ;
    a[i] = x;
    cout << i << endl;
  }
  return 0;
}
