#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
int a[N], n, c;
bool check() {
  for (int i = 0; i < n; i++)
    if (a[i] == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int m;
  cin >> n >> m >> c;
  int l = 0, r = n - 1;
  for (int i = 0; i < m; i++) {
    int d;
    cin >> d;
    if (d <= c / 2) {
      int h = -1;
      for (int j = 0; j < l; j++)
        if (a[j] > d) {
          h = j;
          break;
        }
      if (h == -1) {
        cout << l + 1 << endl;
        a[l++] = d;
      } else {
        cout << h + 1 << endl;
        a[h] = d;
      }
    } else {
      int h = -1;
      for (int j = r; j >= 0; j--)
        if (a[j] < d) {
          h = j;
          break;
        }
      if (h == -1) {
        cout << r + 1 << endl;
        a[r--] = d;
      } else {
        cout << h + 1 << endl;
        a[h] = d;
      }
    }
    fflush(stdout);
    if (check()) return 0;
  }
  return 0;
}
