#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c, p, cnt;
  cin >> n;
  cin >> m;
  cin >> c;
  int a[n];
  cnt = n;
  for (int i = 0; i < n; i++) a[i] = 0;
  for (int i = 0; i < m; i++) {
    cin >> p;
    if (p <= c / 2) {
      for (int j = 0; j < n; j++) {
        if (a[j] == 0) {
          a[j] = p;
          cout << j + 1 << "\n";
          cnt--;
          if (cnt == 0) return 0;
          break;
        }
        if (p < a[j]) {
          a[j] = p;
          cout << j + 1 << "\n";
          break;
        }
      }
    } else {
      for (int j = n - 1; j >= 0; j--) {
        if (a[j] == 0) {
          a[j] = p;
          cout << j + 1 << "\n";
          cnt--;
          if (cnt == 0) return 0;
          break;
        }
        if (p > a[j]) {
          a[j] = p;
          cout << j + 1 << "\n";
          break;
        }
      }
    }
  }
}
