#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, m, c, cnt, A[maxn], last, s1, s2;
bool mark[maxn];
int R() {
  int x;
  scanf("%d", &x);
  last = x;
  return x;
}
void W(int x) {
  printf("%d\n", x);
  fflush(stdout);
  if (!mark[x]) cnt++;
  mark[x] = 1;
  A[x] = last;
  if (cnt == n) exit(0);
}
int32_t main() {
  scanf("%d%d%d", &n, &m, &c);
  for (int i = int(1); i < int(n + 1); i++) A[i] = c + 1;
  s2 = n + 1;
  for (int i = int(0); i < int(m); i++) {
    int x = R();
    if (x <= c / 2) {
      int j = 1;
      for (; j <= s1; j++) {
        if (A[j] > x) {
          break;
        }
      }
      s1 = max(j, s1);
      W(j);
    } else {
      int j = n;
      for (; j >= s2; j--) {
        if (A[j] < x) {
          break;
        }
      }
      s2 = min(j, s2);
      W(j);
    }
    if (s2 - s1 == 1) return 0;
  }
}
