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