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