#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using f64 = double;
using pii = pair<int, int>;
vector<int> l, r;
vector<int>::iterator it;
int n, m, c, first;
void push_left(int first) {
  if (l.empty()) {
    l.push_back(first);
    cout << 1 << endl;
    return;
  }
  int pos(-1);
  for (int msk = 1 << 20; msk > 0; msk /= 2)
    if (pos + msk < l.size() && l[pos + msk] <= first) pos += msk;
  pos += 1;
  if (pos == l.size()) {
    l.push_back(first);
    cout << pos + 1 << endl;
  } else {
    l[pos] = first;
    cout << pos + 1 << endl;
  }
}
void push_right(int first) {
  if (r.empty()) {
    r.push_back(-first);
    cout << n << endl;
    return;
  }
  int pos(-1);
  first *= -1;
  for (int msk = 1 << 20; msk > 0; msk /= 2)
    if (pos + msk < r.size() && r[pos + msk] <= first) pos += msk;
  pos += 1;
  if (pos == r.size()) {
    r.push_back(first);
    cout << n - pos << endl;
  } else {
    r[pos] = first;
    cout << n - pos << endl;
  }
}
int main() {
  cin >> n >> m >> c;
  while (m-- && l.size() + r.size() < n) {
    if (cin >> first) {
      if (first <= c / 2)
        push_left(first);
      else
        push_right(first);
    } else
      return 0;
  }
  return 0;
}
