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