#include <bits/stdc++.h>
using namespace std;
int getnum() {
  int a;
  cin >> a;
  return a;
}
void send(int k) { cout << k + 1 << endl; }
int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> A(N, -1);
  int L = 0, R = N - 1;
  while (M--) {
    int c = getnum();
    if (c <= C / 2) {
      int pt = L;
      while (pt > 0 && A[pt - 1] > c) pt--;
      send(pt);
      A[pt] = c;
      if (pt == L) L++;
    } else {
      int pt = R;
      while (pt < N - 1 && c > A[pt + 1]) pt++;
      send(pt);
      A[pt] = c;
      if (pt == R) R--;
    }
    if (L > R) return 0;
  }
  return 0;
}
