#include <bits/stdc++.h>
using namespace std;
int get() {
  int x;
  scanf("%d", &x);
  return x;
}
void putin(int x) {
  printf("%d\n", x);
  fflush(stdout);
}
int n, m, c;
int a[1100];
int main() {
  cin >> n >> m >> c;
  bool flag = 0;
  for (register int i = 1; i <= m; ++i) {
    int now = get();
    if (now <= c / 2) {
      int pos = 1;
      while (a[pos] && a[pos] <= now) ++pos;
      if (pos <= n) a[pos] = now;
      putin(pos);
    } else {
      int pos = n;
      while (a[pos] && a[pos] >= now) --pos;
      if (pos >= 1) a[pos] = now;
      putin(pos);
    }
    bool nowflag = 1;
    for (register int i = 1; i < n; ++i)
      if (a[i] == 0) nowflag = 0;
    for (register int i = 1; i < n; ++i)
      if (a[i] > a[i + 1]) nowflag = 0;
    flag |= nowflag;
    if (flag) return 0;
  }
  assert(flag);
  return 0;
}
