#include <bits/stdc++.h>
using namespace std;
long long readi() {
  long long input = 0;
  char c = ' ';
  while (c < '-') {
    c = getchar();
  }
  bool negative = false;
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  while (c >= '0') {
    input = 10 * input + (c - '0');
    c = getchar();
  }
  if (negative) {
    input = -input;
  }
  return input;
}
void printi(long long output) {
  if (output == 0) {
    putchar('0');
    return;
  }
  if (output < 0) {
    putchar('-');
    output = -output;
  }
  int aout[20];
  int ilen = 0;
  while (output) {
    aout[ilen] = ((output % 10));
    output /= 10;
    ilen++;
  }
  for (int i = ilen - 1; i >= 0; i--) {
    putchar(aout[i] + '0');
  }
  return;
}
string reads() {
  string input = "";
  char c = ' ';
  while (c <= ' ') {
    c = getchar();
  }
  while (c > ' ') {
    input += c;
    c = getchar();
  }
  return input;
}
int sgn(long long x) {
  if (x < 0) {
    return -1;
  }
  if (x > 0) {
    return 1;
  }
  return 0;
}
long long randomize(long long x) {
  return (((1ll << 31) * rand()) + rand()) % x;
}
const long double PI = 4.0 * atan(1.0);
const long double EPS = 0.00000000000000000001;
long long normalize(long long x) {
  return (((x % 1000000007) + 1000000007) % 1000000007);
}
int N, Q, K;
int arr[1010];
bool check() {
  for (int i = 0; i < N; i++) {
    if (arr[i] == 0) {
      return false;
    }
  }
  for (int i = 1; i < N; i++) {
    if (arr[i - 1] > arr[i]) {
      return false;
    }
  }
  return true;
}
void put(int x) {
  cout << x + 1 << '\n';
  fflush(stdout);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  srand(time(0));
  if (fopen("cf896b.in", "r")) {
    freopen("cf896b.in", "r", stdin);
    freopen("cf896b.out", "w", stdout);
  }
  cin >> N >> Q >> K;
  while (Q--) {
    int x;
    cin >> x;
    if (x <= K / 2) {
      for (int i = 0; i < N; i++) {
        if (arr[i] == 0 || x < arr[i]) {
          put(i);
          arr[i] = x;
          break;
        }
      }
    } else {
      for (int i = N - 1; i >= 0; i--) {
        if (arr[i] == 0 || x > arr[i]) {
          put(i);
          arr[i] = x;
          break;
        }
      }
    }
    if (check()) {
      return 0;
    }
  }
  return 0;
}
