#include <bits/stdc++.h>
using namespace std;
long long f(long long p, long long c) {
  if (p <= (c / 2)) {
    return 0;
  }
  return 1;
}
struct obj {
  long long val;
  long long mn;
  long long mx;
};
int main() {
  long long n, m, c;
  cin >> n >> m >> c;
  vector<obj> a(n);
  for (long long i = 0; i < n; ++i) {
    a[i].val = -1;
    a[i].mx = 1e18;
    a[i].mn = -1;
  }
  long long p;
  while (1) {
    if (cin >> p) {
      long long boxFil = f(p, c);
      long long output;
      if (boxFil == 0) {
        output = n;
        for (long long i = 0; i < n; ++i) {
          if (a[i].val == -1) {
            output = i + 1;
            a[i].val = p;
            break;
          } else if (a[i].val > p) {
            output = i + 1;
            a[i].val = p;
            break;
          }
        }
      } else {
        output = 1;
        for (long long i = n - 1; i >= 0; --i) {
          if (a[i].val == -1) {
            output = i + 1;
            a[i].val = p;
            break;
          } else if (a[i].val < p) {
            output = i + 1;
            a[i].val = p;
            break;
          }
        }
      }
      cout << output << endl;
    } else {
      break;
    }
  }
  return 0;
}
