#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = 1000 * 1000 * 1000 + 21;
const long long int LLINF = (1ll << 60) + 5;
const int MOD = 1000 * 1000 * 1000 + 7;
const int MAX_N = 1000 + 5;
int n, m, c;
int arr[MAX_N];
int main() {
  for (int i = 0; i < MAX_N; ++i) arr[i] = -1;
  scanf("%d%d%d", &n, &m, &c);
  int bad = n;
  for (int i = 0; i < m && bad; ++i) {
    int x;
    scanf("%d", &x);
    if (2 * x <= c) {
      for (int i = 0; i < n; ++i) {
        if (arr[i] == -1 || arr[i] > x) {
          if (arr[i] == -1) --bad;
          printf("%d\n", i + 1);
          fflush(stdout);
          arr[i] = x;
          break;
        }
      }
    } else {
      for (int i = n - 1; i >= 0; --i) {
        if (arr[i] == -1 || arr[i] < x) {
          if (arr[i] == -1) --bad;
          printf("%d\n", i + 1);
          fflush(stdout);
          arr[i] = x;
          break;
        }
      }
    }
  }
  return 0;
}
