#include <bits/stdc++.h>
using namespace std;
int N, M, C;
int seq[2007];
int insert_l(int p) {
  for (int i = 1; i <= N; i++) {
    if (!seq[i] || seq[i] > p) return (seq[i] = p), i;
  }
}
int insert_r(int p) {
  for (int i = N; i >= 1; i--) {
    if (!seq[i] || seq[i] < p) return (seq[i] = p), i;
  }
}
bool check() {
  for (int i = 1; i <= N; i++) {
    if (!seq[i]) return 0;
  }
  return 1;
}
int main() {
  scanf("%d %d %d", &N, &M, &C);
  int mid = (C + 1) >> 1;
  int p;
  while (M--) {
    scanf("%d", &p);
    int pos = -1;
    if (p <= mid)
      pos = insert_l(p);
    else
      pos = insert_r(p);
    printf("%d\n", pos);
    fflush(stdout);
    if (check()) break;
  }
}
