#include <bits/stdc++.h>
using namespace std;
int n, m, c;
int ans[1001];
int zero;
inline void send(int x, int p) {
  if (ans[x] == 0) --zero;
  ans[x] = p;
  printf("%d\n", x);
  fflush(stdout);
}
int main() {
  scanf("%d %d %d", &n, &m, &c);
  int mid = (c + 1) / 2;
  zero = n;
  for (int round = 1; zero && round <= m; ++round) {
    int p;
    scanf("%d", &p);
    if (p <= mid) {
      int i;
      for (i = 1; i < n; ++i)
        if (ans[i] == 0 || ans[i] > p) {
          break;
        }
      send(i, p);
    } else {
      int i;
      for (i = n; i > 1; --i)
        if (ans[i] == 0 || ans[i] < p) {
          break;
        }
      send(i, p);
    }
  }
}
