#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m, c, a[N];
int main() {
  scanf("%d%d%d", &n, &m, &c);
  int p1 = 0, pn = n + 1, x;
  int cnt = n, res;
  for (int rep = 1; rep <= m; rep++) {
    scanf("%d", &x);
    if (x > c / 2) {
      int i;
      for (i = pn; i <= n; i++)
        if (a[i] >= x) break;
      if (i == pn) {
        pn--;
        cnt--;
        a[res = pn] = x;
      } else
        a[res = i - 1] = x;
    } else {
      int i;
      for (i = 1; i <= p1; i++)
        if (a[i] > x) break;
      if (i == p1 + 1) {
        p1++;
        cnt--;
        a[res = p1] = x;
      } else
        a[res = i] = x;
    }
    printf("%d\n", res);
    fflush(stdout);
    if (cnt == 0) return 0;
  }
  return 0;
}
