#include <bits/stdc++.h>
using namespace std;
int n, m, c;
int a[1005];
bool check() {
  bool good = a[0] > 0;
  for (int i = 1; i < n; i++) good &= (a[i] > 0) && (a[i] >= a[i - 1]);
  return good;
}
int main() {
  cin >> n >> m >> c;
  for (int i = 0; i < n; i++) a[i] = 0;
  while (m--) {
    if (check()) return 0;
    int p;
    cin >> p;
    if (p <= c / 2) {
      for (int i = 0; i < n; i++) {
        if (a[i] == 0) {
          a[i] = p;
          cout << i + 1;
          break;
        }
        if (a[i] > p) {
          a[i] = p;
          cout << i + 1;
          break;
        }
      }
    } else {
      for (int i = n - 1; i >= 0; i--) {
        if (a[i] == 0) {
          a[i] = p;
          cout << i + 1;
          break;
        }
        if (a[i] < p) {
          a[i] = p;
          cout << i + 1;
          break;
        }
      }
    }
    cout << endl;
  }
  return 0;
}
