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