#include <bits/stdc++.h>
using namespace std;
int a[1100];
int main() {
  int n, m, c, x;
  cin >> n >> m >> c;
  while (m--) {
    cin >> x;
    if (x * 2 <= c) {
      for (int i = 1; i <= n; i++) {
        if (a[i] > x || !a[i]) {
          a[i] = x;
          cout << i << endl;
          break;
        }
      }
    } else {
      for (int i = n; i != 0; i--) {
        if (a[i] < x || !a[i]) {
          a[i] = x;
          printf("%d\n", i);
          break;
        }
      }
    }
    fflush(stdout);
  }
  return 0;
}
