#include <bits/stdc++.h>
using namespace std;
long long int n, m, c;
long long int a[1005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> c;
  long long int st = 1, en = n, cmi = 1, cmx = c;
  long long int ct = 0;
  while (1) {
    assert(ct < m);
    long long int p;
    cin >> p;
    ct++;
    long long int d1 = abs(cmi - p), d2 = abs(cmx - p);
    if (d1 <= d2) {
      if (p >= cmi) {
        cout << st << endl;
        a[st++] = p;
        cmi = p;
        if (st > en) break;
      } else {
        assert(st > 1);
        assert(a[st - 1] > p);
        for (long long int i = 1; i <= st - 1; ++i) {
          if (a[i] > p) {
            cout << i << endl;
            a[i] = p;
            if (i == st - 1) cmi = p;
            break;
          }
        }
      }
    } else {
      if (p <= cmx) {
        cout << en << endl;
        a[en--] = p;
        cmx = p;
        if (st > en) break;
      } else {
        assert(en < n);
        assert(a[en + 1] < p);
        for (long long int i = n; i >= en + 1; i--) {
          if (a[i] < p) {
            cout << i << endl;
            a[i] = p;
            if (i == en + 1) cmx = p;
            break;
          }
        }
      }
    }
  }
  assert(true);
}
