#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
int n, m, c;
int A[1111];
int pref = 0, post = 0;
bool end() {
  bool ans = true;
  for (int(i) = 0; (i) < (n); (i)++)
    if (A[i] == -1 || (i < n - 1 && A[i + 1] < A[i])) ans = false;
  return ans;
}
int main() {
  memset(A, -1, sizeof(A));
  scanf("%d%d%d", &n, &m, &c);
  int H = (c + 1) / 2;
  for (int(i) = 0; (i) < (m); (i)++) {
    int x;
    scanf("%d", &x);
    if (x <= H) {
      int i = 0;
      while (i < n && (A[i] <= x && A[i] != -1)) i++;
      A[i] = x;
      printf("%d\n", i + 1);
      fflush(stdout);
      if (end()) return 0;
    } else {
      int i = n - 1;
      while (i >= 0 && (A[i] >= x && A[i] != -1)) i--;
      A[i] = x;
      printf("%d\n", i + 1);
      fflush(stdout);
      if (end()) return 0;
    }
  }
  return 0;
}
