#include <bits/stdc++.h>
using namespace std;
vector<int> sol(1010, -1);
int N, M, C;
int main() {
  cin >> N >> M >> C;
  sol[0] = 0;
  sol[N + 1] = C;
  while (M--) {
    int x;
    cin >> x;
    if (x <= C / 2) {
      for (int i = 0; i <= N; ++i) {
        if (sol[i] > x || sol[i] == -1) {
          sol[i] = x;
          cout << i << endl;
          break;
        }
      }
    } else {
      for (int i = N; i >= 0; --i) {
        if (sol[i] < x || sol[i] == -1) {
          sol[i] = x;
          cout << i << endl;
          break;
        }
      }
    }
  }
}
