#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int gcd(int A, int B) {
  if (!B) return A;
  return gcd(B, A % B);
}
bool ok(vector<int> a) {
  int n = a.size();
  for (int i = 0; i < n - 1; i++)
    if (!a[i] || a[i] > a[i + 1]) return false;
  if (!a[n - 1]) return false;
  return true;
}
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> a(n, 0);
  int mid = (c + 1) / 2;
  while (true) {
    int x;
    cin >> x;
    if (x > mid) {
      for (int i = n - 1; i >= 0; i--)
        if (!a[i] || x > a[i]) {
          a[i] = x;
          cout << i + 1 << '\n';
          break;
        }
    } else
      for (int i = 0; i < n; i++)
        if (!a[i] || x < a[i]) {
          a[i] = x;
          cout << i + 1 << '\n';
          break;
        }
    if (ok(a)) break;
    fflush(stdout);
  }
}
