#include <bits/stdc++.h>
using namespace std;
int ar[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, m, c;
  cin >> n >> m >> c;
  int co = 0;
  for (int i = 0; i < m && co < n; i++) {
    int a, j;
    cin >> a;
    if (a * 2 > c)
      for (j = n - 1; j >= 0 && ar[j] >= a; j--)
        ;
    else
      for (j = 0; j < n && ar[j] <= a && ar[j] != 0; j++)
        ;
    if (ar[j] == 0) co += 1;
    ar[j] = a;
    cout << j + 1 << endl;
    fflush(stdout);
  }
  return 0;
}
