#include <bits/stdc++.h>
using namespace std;
int a[1005];
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  for (int i = 1; i <= n; i++) a[i] = 1e9;
  vector<int> esq, dir;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x <= c / 2) {
      int pos = esq.size();
      for (int j = 0; j < esq.size(); j++)
        if (esq[j] > x) {
          pos = j;
          break;
        }
      if (pos == esq.size())
        esq.push_back(x);
      else
        esq[pos] = x;
      cout << pos + 1 << endl;
    } else {
      int pos = dir.size();
      for (int j = 0; j < dir.size(); j++)
        if (x > dir[j]) {
          pos = j;
          break;
        }
      if (pos == dir.size())
        dir.push_back(x);
      else
        dir[pos] = x;
      cout << n - pos << endl;
    }
    if (esq.size() + dir.size() == n) break;
  }
  return 0;
}
