#include <bits/stdc++.h>
using namespace std;
long long ar[200005], n, m, c;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> c;
  while (m--) {
    for (long long i = 0; i < n; i++) {
      if (!ar[i]) break;
      if (i && ar[i] < ar[i - 1]) break;
      if (i == n - 1) return 0;
    }
    long long p;
    cin >> p;
    if (p > (c / 2)) {
      for (long long i = n - 1; i >= 0; i--) {
        if (ar[i] == 0) {
          cout << i + 1 << endl;
          cout.flush();
          ar[i] = p;
          break;
        } else if (ar[i] < p) {
          cout << i + 1 << endl;
          cout.flush();
          ar[i] = p;
          break;
        }
      }
    } else {
      for (long long i = 0; i < n; i++) {
        if (ar[i] == 0) {
          cout << i + 1 << endl;
          cout.flush();
          ar[i] = p;
          break;
        } else if (ar[i] > p) {
          cout << i + 1 << endl;
          cout.flush();
          ar[i] = p;
          break;
        }
      }
    }
  }
  return 0;
}
