#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
int n, m, c;
int a[MAXN];
bool check() {
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      return false;
    }
  }
  for (int i = 1; i < n; i++) {
    if (a[i] < a[i - 1]) {
      return false;
    }
  }
  return true;
}
int main() {
  cin >> n >> m >> c;
  for (int i = 0; i < m; i++) {
    int p;
    cin >> p;
    int k;
    if (c == 1)
      k = n / 2;
    else {
      k = round((double)((n - 1) * (p - 1)) / (c - 1));
    }
    if (a[k] == 0) {
      a[k] = p;
      cout << k + 1 << endl;
    } else {
      int l = k, r = k;
      while (l > 0 && a[l] >= p && a[l] > 0 && (a[l - 1] >= p || a[l - 1] == 0))
        l--;
      while (r < n - 1 && a[r] <= p && a[r] > 0 && a[r + 1] <= p) r++;
      if (a[l] == 0 && (a[r] != 0 || k - l < r - k)) {
        a[l] = p;
        cout << l + 1 << endl;
      } else {
        a[r] = p;
        cout << r + 1 << endl;
      }
      fflush(stdout);
    }
    if (check()) {
      return 0;
    }
  }
  return 0;
}
