#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e3 + 50;
int a[Maxn], c, n, m, mid;
inline bool check() {
  if (!a[1]) return false;
  int vv = a[1];
  for (int i = 2; i <= n; i++) {
    if (!a[i]) return false;
    if (a[i] > vv) return false;
    vv = a[i];
  }
  return true;
}
int main() {
  cin >> n >> m >> c;
  int v;
  for (int i = 1; i <= m; i++) {
    cin >> v;
    int bz = 0;
    if (v > c / 2) {
      for (int i = 1; i <= n; i++)
        if (a[i] < v) {
          a[i] = v;
          bz = 1;
          cout << (n - i + 1) << endl;
          break;
        }
      if (!bz) a[n] = v, cout << 1 << endl;
      fflush(stdout);
    } else {
      for (int i = n; i >= 1; i--)
        if (a[i] > v || !a[i]) {
          a[i] = v;
          bz = 1;
          cout << (n - i + 1) << endl;
          break;
        }
      if (!bz) a[1] = v, cout << n << endl;
      fflush(stdout);
    }
    if (check()) return 0;
  }
}
