#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int n, m, c, v[maxn];
inline void insertLeft(int val) {
  for (int i = 1; i <= n; i++)
    if (!v[i] || v[i] > val) {
      cout << i << endl;
      v[i] = val;
      return;
    }
}
inline void insertRight(int val) {
  for (int i = n; i >= 1; i--)
    if (!v[i] || v[i] < val) {
      cout << i << endl;
      v[i] = val;
      return;
    }
}
inline bool ok() {
  for (int i = 1; i <= n; i++)
    if (v[i] == 0) return false;
  return true;
}
int main() {
  int rounds = 0, x;
  cin >> n >> m >> c;
  while (rounds < m && !ok()) {
    rounds++;
    cin >> x;
    if (x <= c / 2)
      insertLeft(x);
    else
      insertRight(x);
  }
  return 0;
}
