#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long int MAX = 1e9 + 7;
void array_show(int *array, int array_n, char middle = ' ') {
  for (int i = 0; i < array_n; i++)
    printf("%d%c", array[i], (i != array_n - 1 ? middle : '\n'));
}
void array_show(long long int *array, int array_n, char middle = ' ') {
  for (int i = 0; i < array_n; i++)
    printf("%lld%c", array[i], (i != array_n - 1 ? middle : '\n'));
}
void array_show(vector<int> &vec_s, char middle = ' ') {
  for (int i = 0; i < vec_s.size(); i++)
    printf("%d%c", vec_s[i], (i != vec_s.size() - 1 ? middle : '\n'));
}
void array_show(vector<long long int> &vec_s, char middle = ' ') {
  for (int i = 0; i < vec_s.size(); i++)
    printf("%lld%c", vec_s[i], (i != vec_s.size() - 1 ? middle : '\n'));
}
int t[1005];
int main() {
  int n, m, p;
  int i, j, k;
  int a, b, c;
  cin >> n >> m >> p;
  for (i = 0; i < m; i++) {
    cin >> a;
    if (a <= p / 2) {
      for (j = 0; j < n; j++) {
        if (t[j] == 0 || t[j] > a) break;
      }
      cout << j + 1 << endl;
      t[j] = a;
    } else {
      for (j = n - 1; j >= 0; j--) {
        if (t[j] == 0 || t[j] < a) break;
      }
      cout << j + 1 << endl;
      t[j] = a;
    }
    for (j = 0; j < n - 1; j++) {
      if (t[j] == 0 || t[j + 1] == 0) break;
      if (t[j] > t[j + 1]) break;
    }
    if (j == n - 1) return 0;
  }
}
