#include <bits/stdc++.h>
inline void read(int &x) {
  static char c;
  for (c = getchar(); !('0' <= c && c <= '9'); c = getchar())
    ;
  for (x = 0; ('0' <= c && c <= '9'); c = getchar()) x = x * 10 + c - 48;
}
using namespace std;
void write(int x) {
  if (x < 10) {
    putchar('0' + x);
    return;
  }
  write(x / 10);
  putchar('0' + x % 10);
}
inline void writel(int x) {
  if (x < 0) putchar('-'), x *= -1;
  write(x);
  putchar('\n');
}
int n, m, c, to1, tot, a[6007], x;
signed main() {
  read(n);
  read(m);
  read(c);
  a[0] = -100007;
  a[++n] = 1000007;
  to1 = n;
  while (tot + 1 < to1) {
    read(x);
    if (x <= c / 2) {
      for (int i = tot; ~i; i--)
        if (a[i] <= x) {
          a[i + 1] = x;
          writel(i + 1);
          fflush(stdout);
          break;
        }
      if (a[tot + 1]) tot++;
    } else {
      for (int i = to1; i <= n; i++)
        if (a[i] >= x) {
          a[i - 1] = x;
          writel(i - 1);
          fflush(stdout);
          break;
        }
      if (a[to1 - 1]) to1--;
    }
  }
  return 0;
}
