#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c, k, a[10005];
  cin >> n >> m >> c;
  int mid = c / 2;
  int cnt = 0;
  while (m--) {
    cin >> k;
    if (k <= mid)
      for (int i = 1; i <= n; i++) {
        if (a[i] == 0) {
          a[i] = k, cnt++;
          cout << i << endl;
          break;
        }
        if (a[i] > k) {
          a[i] = k;
          cout << i << endl;
          break;
        }
      }
    else
      for (int i = n; i >= 1; i--) {
        if (a[i] == 0) {
          a[i] = k, cnt++;
          cout << i << endl;
          break;
        }
        if (a[i] < k) {
          a[i] = k;
          cout << i << endl;
          break;
        }
      }
    if (cnt == n) break;
  }
  return 0;
}
