#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000007;
const long long linf = 1ll * inf * inf;
const int N = 1000000 + 7;
const int M = 30;
const int multipleTest = 0;
int n, m, c;
int cnt;
int leftPointer = 0, rightPointer;
int a[N];
int read() {
  int x;
  cin >> x;
  return x;
}
void my_write(int x) {
  printf("%d\n", x);
  fflush(stdout);
}
void handleLeft(int val) {
  if (leftPointer == 0 || a[leftPointer] <= val) {
    a[++leftPointer] = val;
    my_write(leftPointer);
  } else {
    bool found = false;
    for (int i = leftPointer; i > 0; --i)
      if (val < a[i] && val >= a[i - 1]) {
        a[i] = val;
        my_write(i);
        found = true;
        break;
      }
    if (!found) {
      a[1] = val;
      my_write(1);
    }
  }
}
void handleRight(int val) {
  if (rightPointer == n + 1 || a[rightPointer] >= val) {
    a[--rightPointer] = val;
    my_write(rightPointer);
  } else {
    bool found = false;
    for (int i = rightPointer; i <= n; ++i)
      if (val > a[i] && val <= a[i + 1]) {
        a[i] = val;
        my_write(i);
        found = true;
        break;
      }
    if (!found) {
      a[n] = val;
      my_write(n);
    }
  }
}
void solve() {
  cin >> n >> m >> c;
  leftPointer = 0;
  rightPointer = n + 1;
  a[rightPointer] = inf;
  for (int j = 0; j < m; ++j) {
    int x = read();
    if (x <= c / 2)
      handleLeft(x);
    else
      handleRight(x);
    if (leftPointer + 1 >= rightPointer) break;
  }
}
int main() {
  int Test = 1;
  if (multipleTest) {
    cin >> Test;
  }
  for (int i = 0; i < Test; ++i) {
    solve();
  }
}
