#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, m, c;
  cin >> n >> m >> c;
  for (int i = 1; i <= m; i++) {
    int x, ans;
    cin >> x;
    if (x <= c / 2) {
      for (int j = 1; j <= n; j++) {
        if (x < a[j] || a[j] == 0) {
          a[j] = x;
          ans = j;
          break;
        }
      }
    } else {
      for (int j = n; j >= 1; j--) {
        if (x > a[j] || a[j] == 0) {
          a[j] = x;
          ans = j;
          break;
        }
      }
    }
    cout << ans << endl;
  }
}
