#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int q1[MAXN], q2[MAXN], r1, r2;
int n, c, m;
int a[MAXN];
bool check() {
  for (int i = 1; i <= n; i++)
    if (!a[i] || (a[i] < a[i - 1])) return false;
  return true;
}
int main() {
  cin >> n >> m >> c;
  while (!check()) {
    int x;
    cin >> x;
    if (x > c / 2) {
      bool flag = false;
      for (int i = 1; i <= r2; i++)
        if (x > q2[i]) {
          q2[i] = x;
          printf("%d\n", n - i + 1);
          flag = true;
          a[n - i + 1] = x;
          break;
        }
      if (!flag) {
        q2[++r2] = x;
        printf("%d\n", n - r2 + 1);
        a[n - r2 + 1] = x;
      }
    } else {
      bool flag = false;
      for (int i = 1; i <= r1; i++)
        if (x < q1[i]) {
          q1[i] = x;
          printf("%d\n", i);
          flag = true;
          a[i] = x;
          break;
        }
      if (!flag) {
        q1[++r1] = x;
        printf("%d\n", r1);
        a[r1] = x;
      }
    }
    fflush(stdout);
  }
  return 0;
}
