#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 1e3 + 5;
const int mod = 1e9 + 7;
int a[maxn], n, m, c;
inline bool check() {
  if (!a[1]) return 0;
  for (int i = 2; i < n + 1; i++)
    if (a[i] < a[i - 1]) return 0;
  return 1;
}
inline int L(int x) {
  for (int i = 1; i < n + 1; i++)
    if (!a[i] || a[i] > x) {
      a[i] = x;
      return i;
    }
  return -1;
}
inline int R(int x) {
  for (int i = n + 1 - 1; i >= 1; i--)
    if (!a[i] || a[i] < x) {
      a[i] = x;
      return i;
    }
  return -1;
}
inline void solve() {
  scanf("%d%d%d", &n, &m, &c);
  while (m--) {
    int x;
    scanf("%d", &x);
    if (x <= c / 2) {
      int pos = L(x);
      printf("%d\n", pos);
    } else {
      int pos = R(x);
      printf("%d\n", pos);
    }
    if (check()) break;
    fflush(stdout);
  }
}
int main() {
  solve();
  return 0;
}
