#include <bits/stdc++.h>
using namespace std;
long long int N = 1e9 + 7;
void solve() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> a(n + 4);
  int l = 0, r = n + 1;
  while (l < r - 1) {
    int q;
    cin >> q;
    if (q <= ceil((1.0 * c) / 2)) {
      if (l == 0) {
        a[1] = q;
        l = 1;
        cout << 1 << endl;
        fflush(stdout);
      } else {
        int i;
        for (i = 1; i <= l + 1; i++) {
          if (a[i] > q || !a[i]) {
            break;
          }
        }
        cout << i << endl;
        fflush(stdout);
        a[i] = q;
        if (i == l + 1) {
          l++;
        }
      }
    } else {
      if (r == n + 1) {
        a[n] = q;
        r = n;
        cout << n << endl;
        fflush(stdout);
      } else {
        int i;
        for (i = n; i >= r - 1; i--) {
          if (!a[i] || a[i] < q) {
            break;
          }
        }
        cout << i << endl;
        fflush(stdout);
        if (i == r - 1) {
          r--;
        }
        a[i] = q;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
}
