#include <bits/stdc++.h>
using namespace std;
int n, m, c;
const int maxn = 1000 + 10;
int a[maxn];
bool check() {
  if (!a[1]) return false;
  for (int i = 1; i < n; i++)
    if (!a[i + 1] || a[i] > a[i + 1]) return false;
  return true;
}
int main() {
  scanf("%d%d%d", &n, &m, &c);
  int mid = c / 2;
  while (m--) {
    int x;
    scanf("%d", &x);
    if (x <= mid) {
      for (int i = 1; i < n + 1; i++)
        if (!a[i] || a[i] > x) {
          a[i] = x;
          printf("%d\n", i);
          break;
        }
    } else {
      for (int i = n + 1 - 1; i >= 1; i--)
        if (!a[i] || a[i] < x) {
          a[i] = x;
          printf("%d\n", i);
          break;
        }
    }
    if (check()) return 0;
    fflush(stdout);
  }
  return 0;
}
