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