#include <bits/stdc++.h>
using namespace std;
template <class T>
void test(T a) {
  cout << a << endl;
}
template <class T, class T2>
void test(T a, T2 b) {
  cout << a << " " << b << endl;
}
template <class T, class T2, class T3>
void test(T a, T2 b, T3 c) {
  cout << a << " " << b << " " << c << endl;
}
const int N = 1e6 + 10;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
int ans[N];
int mx[N];
int n;
bool isok() {
  for (int i = 1; i <= n; i++) {
    if (ans[i] == 0) return 0;
    if (i != n && ans[i] > ans[i + 1]) return 0;
  }
  return 1;
}
void work() {
  int m, c;
  cin >> n >> m >> c;
  for (int i = 1; i <= n; i++) {
    mx[i] = c / n;
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x > c / 2) {
      int i;
      for (i = n; i > 1 && ans[i] >= x && ans[i]; i--)
        ;
      ans[i] = x;
      test(i);
    } else {
      int i;
      for (i = 1; i < n && ans[i] >= x && ans[i]; i++)
        ;
      ans[i] = x;
      test(i);
    }
    if (isok()) {
      break;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  work();
}
