#include <bits/stdc++.h>
using namespace std;
long long a[1010], n, m, c;
int main() {
  long long i, j, u, v;
  cin >> n >> m >> c;
  for (i = 1; i <= m; i++) {
    cin >> u;
    if (2 * u <= c) {
      for (j = 1; j <= n; j++) {
        if (a[j] > u || !a[j]) {
          a[j] = u;
          cout << j << endl;
          break;
        }
      }
    } else {
      for (j = n; j >= 1; j--) {
        if (a[j] < u || !a[j]) {
          a[j] = u;
          cout << j << endl;
          break;
        }
      }
    }
    fflush(stdout);
  }
  return 0;
}
