#include <bits/stdc++.h>
using namespace std;
const int mxn = 1010;
int a[mxn], n, m, c, l, r, p;
void out(int i, int x) {
  printf("%d\n", i);
  fflush(stdout);
  a[i] = x;
}
int lp(int x) {
  for (int(i) = (int)(1); (i) <= (int)(l); ++(i))
    if (!a[i] || x < a[i]) return i;
  return 0;
}
int rp(int x) {
  for (int(i) = (int)(n); (i) >= (int)(r); --(i))
    if (!a[i] || x > a[i]) return i;
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &c);
  l = 1, r = n;
  while (m--) {
    if (l > r) break;
    int x;
    scanf("%d", &x);
    if (x <= c / 2) {
      p = lp(x);
      out(p, x);
      if (p == l) ++l;
      continue;
    } else {
      p = rp(x);
      out(p, x);
      if (p == r) --r;
      continue;
    }
  }
  return 0;
}
