#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int half = c / 2;
  vector<int> left, right;
  while (m--) {
    int x;
    cin >> x;
    if (x <= half) {
      int pos = upper_bound((left).begin(), (left).end(), x) - left.begin();
      cout << pos + 1 << endl;
      cout.flush();
      if (pos == ((int)(left).size()))
        left.push_back(x);
      else
        left[pos] = x;
    } else {
      x = -x;
      int pos = upper_bound((right).begin(), (right).end(), x) - right.begin();
      cout << n - pos << endl;
      cout.flush();
      if (pos == ((int)(right).size()))
        right.push_back(x);
      else
        right[pos] = x;
    }
    if (((int)(left).size()) + ((int)(right).size()) == n) break;
  }
  return 0;
}
