#include <bits/stdc++.h>
using namespace std;
int d[1005];
int n, m, c;
bool check() {
  for (int i = 1; i <= n; ++i) {
    if (!d[i] || d[i] < d[i - 1]) return false;
  }
  return true;
}
int main(int argc, char* argv[]) {
  scanf("%d%d%d", &n, &m, &c);
  while (m--) {
    int p;
    scanf("%d", &p);
    if (p <= c / 2) {
      int pos;
      for (pos = 1; pos <= n && d[pos] > 0 && d[pos] <= p; ++pos)
        ;
      if (pos == n + 1)
        assert(0);
      else {
        d[pos] = p;
        printf("%d\n", pos);
        fflush(stdout);
      }
    } else {
      int pos;
      for (pos = n; pos >= 1 && d[pos] > 0 && d[pos] >= p; --pos)
        ;
      if (pos == 0)
        assert(0);
      else {
        d[pos] = p;
        printf("%d\n", pos);
        fflush(stdout);
      }
    }
    if (check()) break;
  }
  return 0;
}
