#include <bits/stdc++.h>
using namespace std;
int ar[1000 + 2];
int main() {
  int n, m, c, p;
  scanf("%d %d %d", &n, &m, &c);
  int pref = 0;
  int suf = n + 1;
  int i;
  while (scanf("%d", &p)) {
    if (p <= c / 2) {
      if (pref == 0) {
        ar[1] = p;
        pref = 1;
        printf("1\n");
        fflush(stdout);
      } else {
        for (i = 1; i <= pref; i++) {
          if (ar[i] > p) {
            ar[i] = p;
            printf("%d\n", i);
            fflush(stdout);
            break;
          }
        }
        if (i == pref + 1) {
          pref++;
          ar[i] = p;
          printf("%d\n", i);
          fflush(stdout);
        }
      }
    } else {
      if (suf == n + 1) {
        ar[n] = p;
        suf = n;
        printf("%d\n", n);
        fflush(stdout);
      } else {
        for (i = n; i >= suf; i--) {
          if (ar[i] < p) {
            ar[i] = p;
            printf("%d\n", i);
            fflush(stdout);
            break;
          }
        }
        if (i == suf - 1) {
          suf--;
          ar[i] = p;
          printf("%d\n", i);
          fflush(stdout);
        }
      }
    }
    if (suf - pref <= 1) {
      return 0;
    }
  }
}
