#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int M = 1e9 + 7;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(a, -1, sizeof a);
  int n, m, c, u = 0;
  cin >> n >> m >> c;
  while (m--) {
    int v;
    cin >> v;
    bool done = false;
    if (v <= c / 2) {
      for (int j = 1; j <= n && !done; j++) {
        if (a[j] == -1) {
          a[j] = v;
          cout << j << endl;
          u++;
          done = 1;
        } else if (a[j] > v) {
          a[j] = v;
          cout << j << endl;
          done = 1;
        }
      }
    } else {
      for (int j = n; j >= 1 && !done; j--) {
        if (a[j] == -1) {
          a[j] = v;
          cout << j << endl;
          u++;
          done = 1;
        } else if (a[j] < v) {
          a[j] = v;
          cout << j << endl;
          done = 1;
        }
      }
    }
    if (u == n) return 0;
  }
  return 0;
}
