#include <bits/stdc++.h>
using namespace std;
const int N = 510031;
int n, m, c;
int ar[N];
bool validate() {
  for (int i = 1; i <= n; i++) {
    if (ar[i] == 0) {
      return false;
    }
  }
  return true;
}
int find1(int val) {
  for (int i = 1; i <= n; i++) {
    if (i > 1 && ar[i - 1] > val) return i - 1;
    if (ar[i] == 0) return i;
  }
  return n;
}
int find2(int val) {
  for (int i = n; i >= 1; --i) {
    if (i < n && ar[i + 1] < val) return i + 1;
    if (ar[i] == 0) return i;
  }
  return 1;
}
int main() {
  cin >> n >> m >> c;
  for (int i = 1; i <= m; i++) {
    int val;
    cin >> val;
    if (val <= c / 2) {
      int Q = find1(val);
      ar[Q] = val;
      cout << Q << endl;
    } else {
      int Q = find2(val);
      ar[Q] = val;
      cout << Q << endl;
    }
    if (validate()) break;
  }
  return 0;
}
