#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
int n, m, c, p, a[N], l, r;
int main() {
  scanf("%d%d%d", &n, &m, &c);
  r = n;
  a[0] = 1;
  a[n + 1] = c;
  while (m--) {
    scanf("%d", &p);
    int i = upper_bound(a + 1, a + l + 1, p) - a;
    int j = lower_bound(a + r + 1, a + n + 1, p) - a - 1;
    if (l && p < a[l] || p == 1) {
      a[i] = p, l = max(l, i);
      printf("%d\n", i);
      fflush(stdout);
    } else if (r < n && p > a[r + 1]) {
      a[j] = p, r = min(r, j - 1);
      printf("%d\n", j);
      fflush(stdout);
    } else {
      int vl = p - a[l], vr = a[r + 1] - p;
      if (vl <= vr) {
        a[i] = p, l = max(l, i);
        printf("%d\n", i);
        fflush(stdout);
      } else {
        a[j] = p, r = min(r, j - 1);
        printf("%d\n", j);
        fflush(stdout);
      }
    }
    if (l == r) break;
  }
  return 0;
}
