#include <bits/stdc++.h>
using namespace std;
void print_x(int);
int main() {
  vector<int> left_list, right_list;
  int n, m, c;
  scanf("%d%d%d", &n, &m, &c);
  while (true) {
    int x;
    scanf("%d", &x);
    if (x <= c / 2) {
      if (left_list.empty() || x >= *left_list.rbegin()) {
        print_x(1 + left_list.size());
        left_list.push_back(x);
      } else {
        auto p = upper_bound(left_list.begin(), left_list.end(), x);
        print_x(1 + (p - left_list.begin()));
        *p = x;
      }
    } else {
      x = -x;
      if (right_list.empty() || x >= *right_list.rbegin()) {
        print_x(n - right_list.size());
        right_list.push_back(x);
      } else {
        auto p = upper_bound(right_list.begin(), right_list.end(), x);
        *p = x;
        print_x(n - (p - right_list.begin()));
      }
    }
    if (left_list.size() + right_list.size() == n) break;
  }
  exit(EXIT_SUCCESS);
}
void print_x(int x) {
  printf("%d\n", x);
  fflush(stdout);
}
