#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, c, i, j, k, x, pos;
  cin >> n >> m >> c;
  vector<int> a(n + 1, 0);
  while (m--) {
    cin >> x;
    if (x <= c / 2) {
      bool found = false;
      for (i = 1; i < n; i++) {
        if ((a[i] == 0) || (a[i] > x)) {
          found = true;
          pos = i;
          break;
        }
      }
      if (!found) pos = n;
    } else {
      bool found = false;
      for (i = n; i > 1; i--) {
        if ((a[i] == 0) || (x > a[i])) {
          found = true;
          pos = i;
          break;
        }
      }
      if (!found) pos = 1;
    }
    a[pos] = x;
    cout << pos << "\n";
    cout.flush();
  }
  return 0;
}
