#include <bits/stdc++.h>
using namespace std;
int n, m, c, x;
int a[1005];
int main() {
  cin >> n >> m >> c;
  a[n + 1] = 2000000000;
  for (int i = 1; i <= m; ++i) {
    cin >> x;
    if (x > c / 2) {
      for (int i = n; i >= 1; --i)
        if (a[i] == 0 || a[i] < x) {
          a[i] = x, cout << i << endl;
          break;
        }
    } else {
      for (int i = 1; i <= n; ++i)
        if (a[i] == 0 || x < a[i]) {
          a[i] = x, cout << i << endl;
          break;
        }
    }
    bool ok = 0;
    for (int i = 1; i <= n; ++i)
      if (a[i] == 0 || a[i] > a[i + 1]) ok = 1;
    if (ok == 0) return 0;
  }
  return 0;
}
