#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> v(n + 2, -1);
  v[0] = 1;
  v[n + 1] = c;
  for (int it = 0; it < m; ++it) {
    int a;
    cin >> a;
    if (a <= c / 2) {
      int ind = 1;
      while (ind < n + 2 && v[ind] != -1 && v[ind] <= a) ++ind;
      if (ind == n + 2) ind--;
      v[ind] = a;
      cout << ind << endl;
      cout << flush;
    } else {
      int ind = n;
      while (ind >= 0 && v[ind] != -1 && v[ind] >= a) --ind;
      if (ind == -1) ++ind;
      v[ind] = a;
      cout << ind << endl;
      cout << flush;
    }
  }
}
