#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int a[MAXN];
int main() {
  ios::sync_with_stdio(false);
  int n, m, c;
  int cnt = 0;
  cin >> n >> m >> c;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x <= c / 2) {
      for (int j = 0; j < n; j++)
        if (a[j] > x or a[j] == 0) {
          if (a[j] == 0) cnt++;
          a[j] = x;
          cout << j + 1 << endl;
          break;
        }
    } else {
      for (int j = n - 1; j >= 0; j--)
        if (a[j] < x or a[j] == 0) {
          if (a[j] == 0) cnt++;
          a[j] = x;
          cout << j + 1 << endl;
          break;
        }
    }
    if (cnt == n) break;
  }
  return 0;
}
