#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> v(n, 0);
  for (int i = 0; i < m; i++) {
    int e;
    cin >> e;
    if (e <= ceil((double)c / 2)) {
      for (int i = 0; i < n; i++) {
        if (e < v[i] || v[i] == 0) {
          v[i] = e;
          cout << i + 1 << endl;
          break;
        }
      }
    } else {
      for (int i = n - 1; i >= 0; i--) {
        if (e > v[i] || v[i] == 0) {
          v[i] = e;
          cout << i + 1 << endl;
          break;
        }
      }
    }
    fflush(stdout);
  }
  return 0;
}
