#include <bits/stdc++.h>
using namespace std;
long long int arr[100005];
int main() {
  long long int n, m, c;
  cin >> n >> m >> c;
  bool possible(true);
  while (m--) {
    long long int a;
    cin >> a;
    if (a > c / 2) {
      long long int i = n;
      while (i > 0 && arr[i] >= a) {
        i--;
      }
      arr[i] = a;
      cout << i << "\n";
      fflush(stdout);
    } else {
      long long int i = 1;
      while (arr[i] && i <= n && arr[i] <= a) {
        i++;
      }
      arr[i] = a;
      cout << i << "\n";
      fflush(stdout);
    }
    for (long long int i = 1; i < n; i++) {
      if (!arr[i] || !arr[n]) {
        possible = false;
      }
      if (arr[i] > arr[i + 1]) {
        possible = false;
      }
    }
    if (possible) {
      break;
    }
  }
  return 0;
}
