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