#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int a[N];
int n, m, c;
bool win() {
  if (!a[1]) return false;
  for (int i = 2; i <= n; i++)
    if (a[i] < a[i - 1] || !a[i]) return false;
  return true;
}
int main() {
  cin >> n >> m >> c;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x <= c / 2) {
      for (int i = 1; i <= n; i++) {
        if (!a[i] || a[i] > x) {
          cout << i << endl;
          a[i] = x;
          break;
        }
      }
    } else {
      for (int i = n; i > 0; i--)
        if (!a[i] || a[i] < x) {
          cout << i << endl;
          a[i] = x;
          break;
        }
    }
    if (win()) break;
  }
}
