#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 1000 + 10;
const int mod = 1e9 + 7;
int hh[maxn];
int main() {
  memset(hh, 0, sizeof(hh));
  int n, m, c, x, cnt = 1;
  scanf("%d%d%d", &n, &m, &c);
  while (scanf("%d", &x)) {
    if (x > c / 2) {
      for (int i = n; i >= 1; i--) {
        if (hh[i] < x) {
          hh[i] = x;
          printf("%d\n", i);
          fflush(stdout);
          break;
        }
      }
    } else {
      for (int i = 1; i <= n; i++) {
        if (hh[i] > x || hh[i] == 0) {
          hh[i] = x;
          printf("%d\n", i);
          fflush(stdout);
          break;
        }
      }
    }
    int ok = 1;
    for (int i = 1; i <= n; i++) {
      if (hh[i] == 0 || hh[i] < hh[i - 1]) {
        ok = 0;
        break;
      }
    }
    if (ok) return 0;
  }
  return 0;
}
