#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, m, c, a[maxn];
int main() {
  scanf("%d %d %d", &n, &m, &c);
  for (int _ = 1; _ <= m; _++) {
    int x;
    scanf("%d", &x);
    int cur;
    if (x <= c / 2) {
      cur = 1;
      while (cur < n && a[cur] && a[cur] <= x) cur++;
    } else {
      cur = n;
      while (cur > 1 && a[cur] && a[cur] >= x) cur--;
    }
    a[cur] = x;
    bool flag = 1;
    for (int i = 1; i <= n; i++) flag &= (a[i] > 0);
    for (int i = 1; i < n; i++) flag &= (a[i] <= a[i + 1]);
    if (_ == m && !flag) assert(0);
    printf("%d\n", cur), fflush(stdout);
    if (flag) exit(0);
  }
  return 0;
}
