#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
int n, m, c, p;
int a[1015], b[1015];
int main() {
  scanf("%d%d%d", &n, &m, &c);
  memset(a, 63, sizeof(a)), memset(b, 0, sizeof(b));
  int lp = 0, rp = n + 1;
  while (m--) {
    scanf("%d", &p);
    if (p > (c + 1) / 2) {
      int tp = lower_bound(b + 1, b + n + 1, p) - b - 1;
      b[tp] = p;
      printf("%d\n", tp);
      fflush(stdout);
      if (tp < rp) rp = tp;
    } else {
      int tp = upper_bound(a + 1, a + n + 1, p) - a;
      a[tp] = p;
      printf("%d\n", tp);
      fflush(stdout);
      if (tp > lp) lp = tp;
    }
    if (lp == rp - 1) break;
  }
  return 0;
}
