#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int low = 0;
  int up = 0;
  int arr[n + 1];
  while ((low + up) != n) {
    int p;
    cin >> p;
    if (p > c / 2) {
      int t = n;
      while (n - t < up) {
        if (p > arr[t]) {
          cout << t << endl;
          arr[t] = p;
          break;
        }
        t--;
      }
      if (n - t == up) {
        cout << t << endl;
        arr[t] = p;
        up++;
      }
    } else {
      int t = 1;
      while (t < (low + 1)) {
        if (p < arr[t]) {
          cout << t << endl;
          arr[t] = p;
          break;
        }
        t++;
      }
      if (t == (low + 1)) {
        cout << t << endl;
        arr[t] = p;
        low++;
      }
    }
  }
  return 0;
}
