#include <bits/stdc++.h>
using namespace std;
int N, M, C, P, L, R, i, A[1002];
int main() {
  cin >> N >> M >> C;
  L = 1;
  R = N;
  A[N + 1] = C;
  while (L <= R) {
    cin >> P;
    if (P > C / 2) {
      if (P <= A[R + 1]) {
        cout << R << '\n';
        fflush(stdout);
        A[R] = P;
        R--;
      } else {
        for (i = N; P <= A[i]; i--) {
        }
        cout << i << '\n';
        fflush(stdout);
        A[i] = P;
      }
    } else {
      if (P >= A[L - 1]) {
        cout << L << '\n';
        fflush(stdout);
        A[L] = P;
        L++;
      } else {
        for (i = 1; P >= A[i]; i++) {
        }
        cout << i << '\n';
        fflush(stdout);
        A[i] = P;
      }
    }
  }
}
