#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int mul(int x, int y) {
  long long z = 1LL * x * y;
  return z - z / mod * mod;
}
vector<int> l, r;
int n;
void solvel(int x) {
  if (l.empty() || l.back() <= x) {
    l.push_back(x);
    printf("%d\n", (int)l.size());
  } else {
    int d = upper_bound(l.begin(), l.end(), x) - l.begin();
    l[d] = x;
    printf("%d\n", d + 1);
  }
}
void solver(int x) {
  if (r.empty() || r.back() >= x) {
    r.push_back(x);
    printf("%d\n", n - (int)r.size() + 1);
  } else {
    int d;
    for (d = 0; d < r.size(); d++)
      if (r[d] < x) break;
    r[d] = x;
    printf("%d\n", n - d);
  }
}
int main() {
  int m, c, i, x;
  scanf("%d%d%d", &n, &m, &c);
  while (1) {
    scanf("%d", &x);
    if (x * 2 <= c)
      solvel(x);
    else
      solver(x);
    fflush(stdout);
    if (l.size() + r.size() == n) break;
  }
  return 0;
}
