#include <bits/stdc++.h>
using namespace std;
int arr[1009];
int main() {
  ios::sync_with_stdio(0);
  int n, m, c;
  cin >> n >> m >> c;
  memset(arr, -1, 1009 * sizeof(int));
  for (int mi = 0; mi < m; mi++) {
    int pi;
    cin >> pi;
    int i = 0;
    if (pi <= c / 2) {
      for (i = 0; i < n; i++) {
        if (arr[i] == -1) {
          arr[i] = pi;
          break;
        } else if (arr[i] > pi) {
          arr[i] = pi;
          break;
        }
      }
    } else {
      for (i = n - 1; i >= 0; i--) {
        if (arr[i] == -1) {
          arr[i] = pi;
          break;
        } else if (arr[i] < pi) {
          arr[i] = pi;
          break;
        }
      }
    }
    cout << i + 1 << endl;
    int flg = 0;
    i = 1;
    for (i = 0; i < n; i++) {
      if (arr[i] == -1) {
        flg = 1;
        break;
      }
    }
    if (flg == 0 && i == n) break;
  }
}
