#include <bits/stdc++.h>
using namespace std;
int n, m, c;
int num[1005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> c;
  memset(num, 0, sizeof(num));
  for (int i = 1; i <= m; i++) {
    int in;
    cin >> in;
    if (in * 2 <= c) {
      for (int j = 1; j <= n; j++) {
        if (num[j] > in || num[j] == 0) {
          num[j] = in;
          cout << j << endl;
          break;
        }
      }
    } else {
      for (int j = n; j >= 1; j--) {
        if (num[j] < in || num[j] == 0) {
          num[j] = in;
          cout << j << endl;
          break;
        }
      }
    }
    bool tmp = true;
    for (int i = 1; i < n; i++) {
      if (num[i] > num[i + 1] || num[i] == 0) tmp = false;
    }
    if (num[n] == 0) tmp = false;
    if (tmp) return 0;
  }
  return 0;
}
