#include <bits/stdc++.h>
using namespace std;
void answer(int pos) {
  printf("%d\n", pos);
  fflush(stdout);
}
int main() {
  int n, m, c;
  scanf("%d %d %d", &n, &m, &c);
  vector<int> start;
  vector<int> einde_reversed;
  while (true) {
    int num;
    scanf("%d", &num);
    if (2 * num > c) {
      bool inserted = false;
      for (int i = 0; i < einde_reversed.size(); i++) {
        if (num > einde_reversed[i]) {
          einde_reversed[i] = num;
          answer(n - i);
          inserted = true;
          break;
        }
      }
      if (!inserted) {
        answer(n - einde_reversed.size());
        einde_reversed.push_back(num);
      }
    } else {
      bool inserted = false;
      for (int i = 0; i < start.size(); i++) {
        if (num < start[i]) {
          start[i] = num;
          answer(i + 1);
          inserted = true;
          break;
        }
      }
      if (!inserted) {
        answer(start.size() + 1);
        start.push_back(num);
      }
    }
    if (start.size() + einde_reversed.size() == n) break;
  }
  return 0;
}
