#include <bits/stdc++.h>
using namespace std;
int arr[1009];
int L, R;
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  L = 0, R = n - 1;
  while (L <= R) {
    int x;
    cin >> x;
    if (x <= c / 2) {
      int i = L;
      while (i > 0 && arr[i - 1] > x) i--;
      arr[i] = x;
      if (i == L) L++;
      cout << i + 1 << endl;
    } else {
      int i = R;
      while (i < n - 1 && arr[i + 1] < x) i++;
      arr[i] = x;
      if (i == R) R--;
      cout << i + 1 << endl;
    }
  }
}
