#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> v1, v2;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (t <= c / 2) {
      int ind = upper_bound((v1).begin(), (v1).end(), t) - v1.begin();
      if (ind == v1.size()) v1.emplace_back();
      v1[ind] = t;
      cout << ind + 1 << endl;
    } else {
      int ind = upper_bound((v2).begin(), (v2).end(), -t) - v2.begin();
      if (ind == v2.size()) v2.emplace_back();
      v2[ind] = -t;
      cout << n - ind << endl;
    }
    if (v1.size() + v2.size() == n) return 0;
  }
}
