#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
const int MAX_C = 1000;
int main() {
  int i, j, f, N, R, c, C;
  int ix[MAX_C + 1], nb[MAX_N];
  scanf("%d %d %d", &N, &R, &C);
  for (i = 1; i <= C; i++) ix[i] = (N / C) * (i - 1);
  memset(nb, 0, sizeof nb);
  while (R--) {
    scanf("%d", &c);
    if (c == C) {
      for (i = N - 1; nb[i] != 0 && nb[i] == C; i--)
        ;
      nb[i] = c;
      do {
        fprintf(stdout, "%d\n", i + 1);
        fflush(stdout);
      } while (0);
    } else {
      for (i = ix[c]; i < N && nb[i] != 0 && nb[i] <= c; i++)
        ;
      if (i == N) {
        for (i = N - 1; nb[i] == c; i--)
          ;
        nb[i] = c;
        do {
          fprintf(stdout, "%d\n", i + 1);
          fflush(stdout);
        } while (0);
      } else if (nb[i] == 0) {
        nb[i] = c;
        do {
          fprintf(stdout, "%d\n", i + 1);
          fflush(stdout);
        } while (0);
      } else {
        for (j = i + 1; j < N && nb[j] != 0; j++)
          ;
        if (j < N) {
          nb[i] = c;
          do {
            fprintf(stdout, "%d\n", i + 1);
            fflush(stdout);
          } while (0);
        } else {
          for (j = i - 1; nb[j] == c; j--)
            ;
          nb[j] = c;
          do {
            fprintf(stdout, "%d\n", j + 1);
            fflush(stdout);
          } while (0);
        }
      }
    }
    f = 1;
    for (i = 0; i < N; i++)
      if (nb[i] == 0) {
        f = 0;
        break;
      }
    if (f) break;
  }
  return 0;
}
