#include <bits/stdc++.h>
using namespace std;
const double g = 10.0, eps = 1e-12;
const int N = 1000 + 10, maxn = 200000 + 10, inf = 0x3f3f3f3f;
int a[N];
int main() {
  int n, m, c;
  scanf("%d%d%d", &n, &m, &c);
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    if (x <= c / 2) {
      bool f = 0;
      for (int j = 1; j <= n; j++) {
        if (a[j] == 0 || a[j] > x) {
          f = 1;
          a[j] = x;
          printf("%d\n", j);
          break;
        }
      }
      if (!f) printf("%d\n", n);
    } else {
      bool f = 0;
      for (int j = n; j >= 1; j--) {
        if (a[j] == 0 || a[j] < x) {
          f = 1;
          a[j] = x;
          printf("%d\n", j);
          break;
        }
      }
      if (!f) printf("%d\n", 1);
    }
    fflush(stdout);
  }
  return 0;
}
