#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vii = vector<pii>;
using vs = vector<string>;
const int DX[] = {0, -1, 0, 1};
const int DY[] = {-1, 0, 1, 0};
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFLL = 4e18;
const int MAX = 1e3;
int n, m, c, arr[MAX + 10];
void read() { cin >> n >> m >> c; }
int put(bool dir, int p) {
  if (dir) {
    for (int i = (int)1; i <= (int)n; i++) {
      if (arr[i] == 0 || arr[i] > p) {
        arr[i] = p;
        return i;
      }
    }
  } else {
    for (int i = (int)n; i >= (int)1; i--) {
      if (arr[i] == 0 || arr[i] < p) {
        arr[i] = p;
        return i;
      }
    }
  }
}
bool win() {
  for (int i = (int)1; i <= (int)n; i++) {
    if (arr[i] == 0) return false;
    if (i >= 2 && arr[i - 1] > arr[i]) return false;
  }
  return true;
}
void solve() {
  for (int q = 0; q < (int)m; q++) {
    int p;
    cin >> p;
    if (p <= c / 2) {
      cout << put(1, p) << endl;
    } else {
      cout << put(0, p) << endl;
    }
    if (win()) return;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TC = 1;
  while (TC--) {
    read();
    solve();
  }
}
