#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
template <class T>
void show(T a) {
  for (auto x : a) cout << x << " ";
  cout << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> a(n + 1, 0);
  for (int iter = 0; iter < int(m); ++iter) {
    int x;
    cin >> x;
    if (x <= c / 2) {
      for (int i = 1; i <= n; ++i) {
        if (a[i] == 0 || a[i] > x || i == n) {
          a[i] = x;
          cout << i << endl;
          break;
        }
      }
    } else {
      for (int i = n; i >= 1; --i) {
        if (a[i] == 0 || i == 1 || a[i] < x) {
          a[i] = x;
          cout << i << endl;
          break;
        }
      }
    }
    bool ok = true;
    for (int i = 1; i <= n; ++i) {
      if (a[i] == 0) ok = false;
    }
    if (ok) break;
  }
}
