#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 5;
const long long INF = 1e14;
int main() {
  ios::sync_with_stdio(false);
  int a[1005];
  int n, m, c;
  int p;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &c);
  for (long long i = 1; i < n + 1; i++) a[i] = 0;
  while (m--) {
    scanf("%d", &p);
    int i;
    if (p * 2 > c) {
      for (i = n; a[i] >= p; --i)
        ;
    } else {
      for (i = 1; a[i] != 0 && a[i] <= p; ++i)
        ;
    }
    printf("%d\n", i);
    fflush(stdout);
    a[i] = p;
    bool done = true;
    for (long long i = 1; i < n + 1; i++) {
      if (a[i] == 0) {
        done = false;
        break;
      }
    }
    if (done) return 0;
  }
  return 0;
}
