#include <bits/stdc++.h>
using namespace std;
long long n, m, c, ans;
long long s[1005];
int main() {
  memset(s, -1, sizeof(s));
  cin >> n >> m >> c;
  long long l = 1, r = n;
  long long m1 = (l + r) / 2;
  while (m--) {
    long long ok = 1;
    for (long long i = 1; i <= n; i++) {
      if (s[i] == -1) ok = 0;
      if (s[i] < s[i - 1]) ok = 0;
    }
    if (ok) return 0;
    long long x;
    cin >> x;
    if (x == 1) {
      cout << l << endl;
      s[l] = x;
      l++;
      continue;
    }
    if (x == c) {
      cout << r << endl;
      s[r] = x;
      r--;
      continue;
    }
    long long j = m1;
    while (s[j] != x && s[j] != -1) {
      if (s[j] < x && s[j + 1] > x) break;
      if (s[j] < x)
        j++;
      else
        j--;
    }
    if (j < l) {
      cout << l << endl;
      s[l] = x;
      continue;
    }
    if (j > r) {
      cout << r << endl;
      s[r] = x;
      continue;
    }
    if (s[j] != x) {
      s[j] = x;
      cout << j << endl;
      continue;
    }
    long long l1 = j, r1 = j;
    while (s[l1] == x) l1--;
    while (s[r1] == x) r1++;
    if (l1 < l) {
      s[r1] = x;
      cout << r1 << endl;
    } else if (r1 > r) {
      s[l1] = x;
      cout << l1 << endl;
    } else if (s[l1] == -1 && s[r1] != -1) {
      s[l1] = x;
      cout << l1 << endl;
    } else if (s[l1] != -1 && s[r1] == -1) {
      s[r1] = x;
      cout << r1 << endl;
    } else if (l1 - l > r - r1) {
      s[l1] = x;
      cout << l1 << endl;
    } else {
      s[r1] = x;
      cout << r1 << endl;
    }
  }
}
