#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int main() {
  long long int n, m, c;
  cin >> n >> m >> c;
  long long int l = 0, r = n - 1;
  long long int ar[n + 1];
  while (l <= r) {
    long long int p;
    cin >> p;
    if (p <= c / 2) {
      if (l == 0 || ar[l - 1] <= p) {
        ar[l] = p;
        cout << l + 1 << "\n";
        l++;
      } else {
        long long int z = lower_bound(ar, ar + l, p + 1) - ar;
        ar[z] = p;
        cout << z + 1 << "\n";
      }
    } else {
      if (r == n - 1 || ar[r + 1] >= p) {
        ar[r] = p;
        cout << r + 1 << "\n";
        r--;
      } else {
        long long int z = upper_bound(ar + r + 1, ar + n, p - 1) - ar - 1;
        ar[z] = p;
        cout << z + 1 << "\n";
      }
    }
  }
}
