#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;
int a[1005];
int32_t main() {
  int n, m, c;
  cin >> n >> m >> c;
  memset(a, -1, sizeof(a));
  ;
  int l = 1, r = n;
  for (int _ = 0; _ < m; _++) {
    ;
    if (l > r) {
      break;
    }
    int v;
    cin >> v;
    if (v <= (c) / 2) {
      bool found = false;
      for (int j = 1; j < l; j++) {
        if (a[j] > v) {
          cout << j << endl;
          a[j] = v;
          found = true;
          break;
        }
      }
      if (not found) {
        cout << l << endl;
        a[l] = v;
        l++;
      }
    } else {
      bool found = false;
      for (int j = n; j > r; j--) {
        if (a[j] < v) {
          cout << j << endl;
          a[j] = v;
          found = true;
          break;
        }
      }
      if (not found) {
        cout << r << endl;
        a[r] = v;
        r--;
      }
    }
  }
  return 0;
}
