#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int INF = 1e9;
int main() {
  int n, m, c;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &c);
  vector<int> lhalf(n, INF);
  vector<int> uhalf(n, INF);
  while (m--) {
    int a;
    scanf("%d", &a);
    if (a > c / 2) {
      auto it = upper_bound(uhalf.begin(), uhalf.end(), c - a);
      *it = c - a;
      int idx = it - uhalf.begin();
      printf("%d\n", n - idx);
      fflush(stdout);
    } else {
      auto it = upper_bound(lhalf.begin(), lhalf.end(), a);
      *it = a;
      int idx = it - lhalf.begin();
      printf("%d\n", idx + 1);
      fflush(stdout);
    }
    if (count(lhalf.begin(), lhalf.end(), INF) +
            count(uhalf.begin(), uhalf.end(), INF) <=
        n)
      break;
  }
  return 0;
}
