#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = 2e5 + 5;
int n, m, c, st, en, f[1001];
int main() {
  scanf("%d %d %d", &n, &m, &c);
  st = 0, en = n - 1;
  while (m--) {
    int x;
    scanf("%d", &x);
    if (x <= c / 2) {
      for (int i = 0; i < n; i++) {
        if (!f[i] || f[i] > x) {
          f[i] = x;
          printf("%d\n", i + 1);
          fflush(stdout);
          break;
        }
      }
    } else {
      for (int i = n - 1; ~i; i--) {
        if (!f[i] || f[i] < x) {
          f[i] = x;
          printf("%d\n", i + 1);
          fflush(stdout);
          break;
        }
      }
    }
    x = 1;
    for (int i = 0; i < n; i++) x &= !!f[i];
    for (int i = 1; i < n; i++) x &= f[i] >= f[i - 1];
    if (x) return 0;
  }
  return 0;
}
