#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int mod = 1e9 + 7;
const long long MAX = 5e18;
const long long MIN = -MAX;
const int imax = 2e9 + 100;
int main() {
  time_t t1, t2;
  t1 = clock();
  int n, m, c;
  cin >> n >> m >> c;
  int a[n + 2];
  memset(a, -1, sizeof(a));
  int L = 1, R = n;
  while (m--) {
    int x;
    cin >> x;
    if (x * 2 <= c) {
      if (a[L] == -1) {
        a[L] = x;
        cout << L << endl;
      } else if (x >= a[L]) {
        while (a[L] != -1 and x >= a[L]) L++;
        a[L] = x;
        cout << L << endl;
      } else {
        int i = L;
        while (a[i] > x) i--;
        i++;
        a[i] = x;
        cout << i << endl;
      }
    } else {
      if (a[R] == -1) {
        a[R] = x;
        cout << R << endl;
      } else if (x <= a[R]) {
        while (a[R] != -1 and x <= a[R]) R--;
        a[R] = x;
        cout << R << endl;
      } else {
        int i = R;
        while (a[i] < x and a[i] != -1) i++;
        i--;
        a[i] = x;
        cout << i << endl;
      }
    }
    fflush(stdout);
    vector<int> a1, a2;
    for (int i = 1; i <= n; i++) {
      a1.push_back(a[i]);
      a2.push_back(a[i]);
    }
    sort(a2.begin(), a2.end());
    if (a2[0] != -1 and a1 == a2) return 0;
  }
  cout << "fucked up" << endl;
  t2 = clock();
  cerr << "time taken: " << t2 - t1 << endl;
  return 0;
}
