#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
const int maxm = 10000 + 10;
const int mod = (int)1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
const double PI = acos(-1.0);
int a[maxn];
bool check(int n) {
  for (int i = 1; i <= n; i++) {
    if (!a[i]) return false;
    if (a[i] < a[i - 1]) return false;
  }
  return true;
}
int main() {
  int n, m, c;
  scanf("%d%d%d", &n, &m, &c);
  int l = 1, r = n;
  for (int i = 0; i < m; i++) {
    if (check(n)) break;
    int p;
    scanf("%d", &p);
    if (p > c / 2) {
      for (int i = n; i >= 1; i--) {
        if (a[i] == 0 || p > a[i]) {
          printf("%d\n", i);
          a[i] = p;
          break;
        }
      }
    } else {
      for (int i = 1; i <= n; i++) {
        if (a[i] == 0 || p < a[i]) {
          printf("%d\n", i);
          a[i] = p;
          break;
        }
      }
    }
    fflush(stdout);
  }
  return 0;
}
