#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
int now;
int n, m, c, a[MAX];
int main() {
  cin >> n >> m >> c;
  c /= 2;
  while (m--) {
    int x;
    cin >> x;
    if (x <= c) {
      for (int i = 1; i <= n; i++) {
        if (a[i] == 0 || a[i] > x) {
          a[i] = x;
          cout << i << '\n';
          fflush(stdout);
          break;
        }
      }
    } else {
      for (int i = n; i >= 1; i--) {
        if (a[i] == 0 || a[i] < x) {
          a[i] = x;
          cout << i << '\n';
          fflush(stdout);
          break;
        }
      }
    }
    now = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] != 0) now++;
    }
    if (now == n) break;
  }
  return 0;
}
