#include <bits/stdc++.h>
using namespace std;
int arr[1500];
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int mid = (c + 1) / 2;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    if (x > mid) {
      int pos;
      for (int j = n - 1; j >= 0; --j)
        if (arr[j] == 0 || x > arr[j]) {
          arr[j] = x;
          pos = j + 1;
          break;
        }
      cout << pos << endl;
    } else {
      int pos;
      for (int j = 0; j < n; ++j)
        if (arr[j] == 0 || x < arr[j]) {
          arr[j] = x;
          pos = j + 1;
          break;
        }
      cout << pos << endl;
    }
    bool flag = arr[0] != 0;
    for (int i = 1; i < n; ++i) {
      if (arr[i] == 0 || arr[i] < arr[i - 1]) {
        flag = 0;
        break;
      }
    }
    if (flag) break;
  }
}
