#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int MAXN = 1e3 + 3;
int n, m, c, t, A[MAXN], f;
int main() {
  scanf("%d%d%d", &n, &m, &c);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &t);
    if (t <= c / 2) {
      for (int j = 1; j <= n; j++)
        if (!A[j] || A[j] > t) {
          A[j] = t, f = j;
          break;
        }
    } else {
      for (int j = n; j >= 1; j--)
        if (!A[j] || A[j] < t) {
          A[j] = t, f = j;
          break;
        }
    }
    printf("%d\n", f);
    fflush(stdout);
  }
  return 0;
}
