#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
inline char get(void) {
  static char buf[100000], *S = buf, *T = buf;
  if (S == T) {
    T = (S = buf) + fread(buf, 1, 100000, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
template <typename T>
inline void read(T &x) {
  scanf("%d", &x);
  return;
  static char c;
  x = 0;
  int sgn = 0;
  for (c = get(); c < '0' || c > '9'; c = get())
    if (c == '-') sgn = 1;
  for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
  if (sgn) x = -x;
}
int n, m, c, x, l, r, cc, pos;
int a[N];
inline void Print(int x) {
  printf("%d\n", x);
  fflush(stdout);
}
int main() {
  read(n);
  read(m);
  read(c);
  cc = c + 1;
  c /= 2;
  r = 1;
  l = n;
  while (m--) {
    read(x);
    if (x <= c) {
      for (int i = 1; i <= r; i++)
        if (i == r) {
          pos = r;
          a[r++] = x;
          break;
        } else if ((x >= a[i - 1] || i == 1) && x < a[i]) {
          a[pos = i] = x;
          break;
        }
    } else {
      for (int i = n; i >= l; i--)
        if (i == l) {
          pos = l;
          a[l--] = x;
          break;
        } else if ((x <= a[i + 1] || i == n) && x > a[i]) {
          a[pos = i] = x;
          break;
        }
    }
    Print(pos);
    if (l < r) break;
  }
  return 0;
}
