#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 1;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const long double pi = atan2(0, -1);
const long double eps = 1e-6;
const int ABC = 26;
void check(int n, int *a) {
  bool ok = true;
  for (int i = 0; i < n; i++) {
    if (a[i] == -1) {
      ok = false;
      break;
    }
    if (i > 0 && a[i] < a[i - 1]) {
      ok = false;
      break;
    }
  }
  if (ok) {
    exit(0);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  int n, m, c;
  cin >> n >> m >> c;
  int a[n];
  fill(a, a + n, -1);
  while (m--) {
    int x;
    cin >> x;
    if (x <= c / 2) {
      int p = 0;
      while (a[p] != -1 && a[p] <= x) p++;
      cout << p + 1 << endl;
      a[p] = x;
    } else {
      int p = n - 1;
      while (a[p] != -1 && a[p] >= x) p--;
      cout << p + 1 << endl;
      a[p] = x;
    }
    check(n, a);
  }
  return 0;
}
