#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
int n, m, c;
int a[N];
int main() {
  cin >> n >> m >> c;
  c >>= 1;
  for (int j = 1; j <= m; ++j) {
    int p;
    cin >> p;
    if (p <= c) {
      for (int i = 1; i <= n; ++i)
        if (!a[i] || a[i] > p) {
          a[i] = p;
          cout << i << '\n';
          fflush(stdout);
          break;
        }
    } else {
      for (int i = n; i; --i)
        if (a[i] < p) {
          a[i] = p;
          cout << i << '\n';
          fflush(stdout);
          break;
        }
    }
    bool flag = true;
    for (int i = 1; i <= n; ++i)
      if (!a[i]) flag = false;
    if (flag) return 0;
  }
  return 0;
}
