#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = (1 << 20) + 5;
constexpr int MOD = 1e9 - 7;
int f[2000], g[2000];
set<int> s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int n, m, c, x;
  memset(f, 0x7f, sizeof f);
  cin >> n >> m >> c;
  int i = 0, j = 0;
  while (cin >> x) {
    if (2 * x > c) {
      int p = lower_bound(g, g + n, x) - g - 1;
      g[p] = x;
      printf("%d\n", p + 1);
    } else {
      int p = upper_bound(f, f + n, x) - f;
      f[p] = x;
      printf("%d\n", p + 1);
    }
    fflush(stdout);
  }
  return 0;
}
