#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long Inf = 1e18;
const int N = 1010;
const int mod = 0;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
template <typename T>
bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
};
template <typename T>
bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
};
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }
void inc(int &a, int b) { a = (a + b >= mod ? a + b - mod : a + b); }
void dec(int &a, int b) { a = (a - b < 0 ? a - b + mod : a - b); }
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + "," + to_string(p.second) + ")";
}
template <typename T>
string to_string(T v) {
  int fst = 1;
  string ret = "{";
  for (auto x : v) {
    if (!fst) ret += ",";
    fst = 0, ret += to_string(x);
  }
  ret += "}";
  return ret;
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  dbg_out(T...);
}
int n, m, c, a[N], h, t;
void print(int x) {
  cout << x << '\n';
  fflush(stdout);
}
int place(int x) {
  if (x <= c / 2) {
    if (x >= a[h])
      return ++h;
    else {
      int p = 1;
      while (a[p] <= x) ++p;
      return p;
    }
  } else {
    if (x <= a[t])
      return --t;
    else {
      int p = n;
      while (a[p] >= x) --p;
      return p;
    }
  }
}
int main() {
  n = gi(), m = gi(), c = gi();
  h = 0, t = n + 1;
  a[t] = c + 1;
  for (int i = 1; i <= m; i++) {
    int x = gi(), pos = place(x);
    print(pos);
    a[pos] = x;
    if (h + 1 == t) return 0;
  }
  return 0;
}
