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