#include <bits/stdc++.h>
using namespace std;
int n, m, c;
vector<int> l;
vector<int> r;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> c;
  while (l.size() + r.size() < n) {
    int val;
    cin >> val;
    if (val <= c / 2) {
      bool temp = 0;
      for (int i = 0; i < (int)l.size(); i++) {
        if (l[i] > val) {
          l[i] = val;
          temp = 1;
          cout << i + 1 << endl;
          break;
        }
      }
      if (!temp) {
        l.push_back(val);
        cout << l.size() << endl;
      }
    } else {
      bool temp = 0;
      for (int i = 0; i < (int)r.size(); i++) {
        if (r[i] < val) {
          r[i] = val;
          cout << n - i << endl;
          temp = 1;
          break;
        }
      }
      if (!temp) {
        r.push_back(val);
        cout << n - r.size() + 1 << endl;
      }
    }
  }
}
