#include <bits/stdc++.h>
long long inf = 1LL << 60;
long long mod = 1000000007;
double pi = acos(-1.0);
using namespace std;
int a[1010];
int n, m, c;
bool check() {
  for (int i = 2; i <= n; i++) {
    if (!a[i] || !a[i - 1] || a[i] < a[i - 1]) return false;
  }
  return true;
}
int main() {
  scanf("%i %i %i", &n, &m, &c);
  while (m--) {
    int p;
    scanf("%i", &p);
    if (p <= c / 2) {
      for (int i = 1; i <= n; i++) {
        if (a[i] > p || !a[i]) {
          a[i] = p;
          printf("%i\n", i);
          fflush(stdout);
          break;
        }
      }
    } else {
      for (int i = n; i >= 1; i--) {
        if (a[i] < p || !a[i]) {
          a[i] = p;
          printf("%i\n", i);
          fflush(stdout);
          break;
        }
      }
    }
    if (check()) return 0;
  }
  return 0;
}
