#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  int n, m, c, k;
  cin >> n >> m >> c;
  for (int i = (0); i < (m + 1); ++i) {
    cin >> k;
    int cur;
    if (k > c / 2) {
      for (int j = n - 1; j >= 0; --j)
        if (a[j] < k || a[j] == 0) {
          a[j] = k, cur = j + 1;
          break;
        }
    } else {
      for (int j = (0); j < (n); ++j)
        if (a[j] > k || a[j] == 0) {
          a[j] = k, cur = j + 1;
          break;
        }
    }
    cout << cur << endl;
    bool flag = true;
    for (int j = (0); j < (n); ++j)
      if (a[j] == 0) {
        flag = false;
        break;
      }
    if (flag) break;
  }
  return 0;
}
