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