#include <bits/stdc++.h>
using namespace std;
void stress();
int main() {
  ios::sync_with_stdio(0);
  stress();
}
long long a[1010];
long long used[1010];
void stress() {
  long long n, m, c;
  cin >> n >> m >> c;
  long long l = 1, r = n;
  for (long long i = 0; i < m; i++) {
    long long x;
    cin >> x;
    if (x == 1) {
      cout << l << endl;
      used[l] = 1;
      a[l] = x;
      l++;
    } else if (x == c) {
      cout << r << endl;
      used[r] = 1;
      a[r] = x;
      r--;
    } else {
      for (long long i = n; i > 0; i--) {
        if (!used[i] || used[i] && a[i] < x) {
          used[i] = 1;
          a[i] = x;
          cout << i << endl;
          break;
        }
      }
    }
    bool ans = 1;
    for (long long i = 1; i <= n; i++) {
      if (!used[i]) ans = 0;
      if (a[i] < a[i - 1]) ans = 0;
    }
    if (ans) break;
  }
}
