#include <bits/stdc++.h>
using namespace std;
long long a[10000000];
int main() {
  long long n, m, c, x, s = 0;
  cin >> n >> m >> c;
  while (m--) {
    cin >> x;
    if (x <= c / 2) {
      long long i = 0;
      while (a[i] != 0 and a[i] <= x) i++;
      if (a[i] == 0) s++;
      a[i] = x;
      cout << i + 1 << endl;
    } else {
      long long i = n - 1;
      while (a[i] != 0 and a[i] >= x) i--;
      if (a[i] == 0) s++;
      a[i] = x;
      cout << i + 1 << endl;
    }
    fflush(stdout);
    if (s == n) return 0;
  }
}
