#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int a[maxn];
int ok(int n) {
  if (a[1] == -1) return 0;
  for (int i = 2; i <= n; i++)
    if (a[i] == -1 || a[i] < a[i - 1]) return 0;
  return 1;
}
int main() {
  memset(a, -1, sizeof(a));
  int n, m, c;
  int x;
  cin >> n >> m >> c;
  while (scanf("%d", &x) == 1) {
    if (x <= c / 2) {
      for (int i = 1; i <= n; i++)
        if (a[i] == -1 || x < a[i]) {
          a[i] = x;
          cout << i << endl;
          fflush(stdout);
          break;
        }
    } else {
      for (int i = n; i >= 1; i--)
        if (a[i] == -1 || x > a[i]) {
          a[i] = x;
          cout << i << endl;
          fflush(stdout);
          break;
        }
    }
    if (ok(n)) exit(0);
  }
  return 0;
}
