#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T x, T y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    T f = x % y;
    x = y;
    y = f;
  }
  return x;
}
void exgcd(long long a, long long b, long long &d, long long &x, long long &y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long inv(long long a, long long m) {
  long long x, y, d;
  exgcd(a, m, d, x, y);
  return d == 1 ? ((x % m) + m) % m : -1;
}
int a[1111];
int main(int argc, char *argv[]) {
  std::cin.sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m, c;
  cin >> n >> m >> c;
  int li = 1, ri = n, n2 = (c + 1) / 2;
  for (int x = 0; x < m; x++) {
    int p;
    cin >> p;
    int idx = -1;
    if (p <= n2) {
      for (int i = 1; i < li; i++)
        if (p < a[i]) {
          idx = i;
          break;
        }
      if (idx == -1) idx = li++;
    } else {
      for (int i = n; i > ri; i--)
        if (p > a[i]) {
          idx = i;
          break;
        }
      if (idx == -1) idx = ri--;
    }
    cout << idx << endl;
    a[idx] = p;
    fflush(stdout);
    if (li > ri) break;
  }
  return 0;
}
