#include <bits/stdc++.h>
const int MXN = 1e6 + 100;
const long long MNN = 5e3 + 100;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9 + 500;
using namespace std;
long long n, k, c;
vector<int> inc, dic;
void query(int x) {
  if (x <= c / 2) {
    int pos = 0;
    for (; pos < inc.size();) {
      if (inc[pos] <= x) {
        pos++;
      } else {
        break;
      }
    }
    cout << pos + 1 << endl;
    if (pos == inc.size()) {
      inc.push_back(x);
    } else {
      inc[pos] = x;
    }
  } else {
    int pos = 0;
    for (; pos < dic.size();) {
      if (dic[pos] >= x) {
        pos++;
      } else {
        break;
      }
    }
    cout << n - pos << endl;
    if (pos == dic.size()) {
      dic.push_back(x);
    } else {
      dic[pos] = x;
    }
  }
}
int main() {
  cin >> n >> k >> c;
  while (k--) {
    long long x;
    cin >> x;
    query(x);
    if (inc.size() + dic.size() == n) return 0;
  }
  return 0;
}
