#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
inline void read(int &x) {
  char ch = getchar();
  int f = 1;
  x = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
int n, m, c, a[2][1050], len[2];
int ins(int id, int p) {
  int pos = upper_bound(a[id] + 1, a[id] + len[id] + 1, p) - a[id];
  a[id][pos] = p;
  chkmax(len[id], pos);
  return pos;
}
int main() {
  int p;
  read(n), read(m), read(c);
  while (1) {
    read(p);
    if (p <= c / 2)
      cout << ins(0, p) << endl;
    else
      p = -p + 1001, cout << n - ins(1, p) + 1 << endl;
    if (len[0] + len[1] == n) return 0;
  }
  return 0;
}
