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