#include <bits/stdc++.h>
using namespace std;
int n, m, c, now;
int num[1005];
int main() {
  scanf("%d%d%d", &n, &m, &c);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &now);
    int mid = c / 2;
    if (now <= mid) {
      for (int j = 1; j <= n; j++) {
        if (num[j] > now || num[j] == 0) {
          num[j] = now;
          printf("%d\n", j);
          fflush(stdout);
          break;
        }
      }
    } else {
      for (int j = n; j >= 1; j--) {
        if (num[j] < now || num[j] == 0) {
          num[j] = now;
          printf("%d\n", j);
          fflush(stdout);
          break;
        }
      }
    }
    bool flag = true;
    for (int i = 1; i < n; i++) {
      if (num[i] > num[i + 1] || num[i] == 0) flag = false;
    }
    if (num[n] == 0) flag = false;
    if (flag) return 0;
  }
}
