#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  long long n, m, c;
  cin >> n >> m >> c;
  vector<long long> board(n);
  while (true) {
    long long num;
    cin >> num;
    bool printed = false;
    if (num <= c / 2) {
      for (int i = 0; i < int(n); ++i)
        if (board[i] == 0 || board[i] > num) {
          board[i] = num;
          cout << i + 1 << endl;
          printed = true;
          break;
        }
    } else {
      for (long long i = n - 1; i >= 0; --i)
        if (board[i] == 0 || board[i] < num) {
          board[i] = num;
          cout << i + 1 << endl;
          printed = true;
          break;
        }
    }
    assert(printed);
    bool finish = (board[n - 1] != 0);
    for (int i = 0; i < int(n - 1); ++i) {
      if (board[i] == 0 || board[i] > board[i + 1]) finish = false;
    }
    if (finish) break;
  }
}
