#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  static int l[1000], r[1000];
  int n, m, c;
  int chalf, sl = 0, sr = 0;
  cin >> n >> m >> c;
  chalf = c / 2;
  for (int i = 0; i < m && sl + sr < n; ++i) {
    int p, j;
    cin >> p;
    if (p <= chalf) {
      j = upper_bound(l, l + sl, p) - l;
      l[j] = p;
      if (j == sl) {
        ++sl;
      }
      ++j;
    } else {
      p = -p;
      j = upper_bound(r, r + sr, p) - r;
      r[j] = p;
      if (j == sr) {
        ++sr;
      }
      j = n - j;
    }
    cout << j << endl;
  }
  return 0;
}
