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