#include <bits/stdc++.h>
int f[100005];
int main() {
  int n, m, c;
  scanf("%d %d %d", &n, &m, &c);
  memset(f, 0, sizeof(f));
  int t, num = 0, pos;
  while (scanf("%d", &t) != EOF) {
    if (t <= c / 2) {
      for (int i = 1; i <= n; ++i) {
        if (f[i] == 0) {
          pos = i;
          f[i] = t;
          num++;
          break;
        } else if (f[i] > t) {
          pos = i;
          f[i] = t;
          break;
        }
      }
    } else {
      for (int i = n; i >= 1; --i) {
        if (f[i] == 0) {
          pos = i;
          f[i] = t;
          num++;
          break;
        } else if (f[i] < t) {
          pos = i;
          f[i] = t;
          break;
        }
      }
    }
    printf("%d\n", pos);
    fflush(stdout);
    if (num == n) break;
  }
}
