#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, c, cnt = 0;
  cin >> n >> m >> c;
  int l = 0, r = n + 1;
  while (cnt < n) {
    int x;
    bool skip = 0;
    cin >> x;
    for (int i = 0; i <= l; i++) {
      if (a[i] > x) {
        cout << i << endl << flush;
        skip = 1;
        a[i] = x;
        break;
      }
    }
    if (skip) continue;
    for (int i = n; i >= r; i--) {
      if (a[i] < x) {
        cout << i << endl << flush;
        skip = 1;
        a[i] = x;
        break;
      }
    }
    if (skip) continue;
    if (x > c / 2) {
      r--;
      cout << r << endl << flush;
      a[r] = x;
    } else {
      l++;
      cout << l << endl << flush;
      a[l] = x;
    }
    cnt++;
  }
}
