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