#include <bits/stdc++.h>
using namespace std;
int ni() {
  int val;
  scanf("%i", &val);
  return val;
}
pair<int, int> npi() {
  pair<int, int> val;
  scanf("%i %i", &val.first, &val.second);
  return val;
}
int64_t nll() {
  int64_t val;
  scanf("%I64d", &val);
  return val;
}
vector<int> nvi(int n, int corr = 0) {
  vector<int> a(n);
  for (int i = 0; i < n; ++i) a[i] = ni() + corr;
  return move(a);
}
char nc() {
  char val;
  do {
    val = getchar();
  } while (val == ' ' || val == '\r' || val == '\n');
  return val;
}
char ncs() {
  char val;
  do {
    val = getchar();
  } while (false);
  return val;
}
string ns() {
  static char buff[1024 * 4000];
  scanf("%s", buff);
  return string{buff};
}
int64_t gcd(int64_t a, int64_t b) {
  while (b) {
    auto tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int64_t tr2(int xv1, int yv1, int xv2, int yv2, int x3, int y3) {
  return 1LL * (xv2 - xv1) * (y3 - yv1) - 1LL * (yv2 - yv1) * (x3 - xv1);
}
const long double eps = 1e-12;
const long double pi = acos(-1.0);
bool eq(long double a, long double b) { return abs(a - b) <= eps; }
int8_t bits_cnt[256];
const string input_dir = "inputs\\";
string input_file = input_dir + "input.txt";
string output_file = input_dir + "output.txt";
void init_streams() {}
void init_data() {
  for (int i = 1; i <= 255; ++i)
    for (int j = 0; j < 8; ++j)
      if ((1 << j) & i) ++bits_cnt[i];
}
int get_bit_count(int v) {
  return bits_cnt[v & 0xFF] + bits_cnt[(v >> 8) & 0xFF] +
         bits_cnt[(v >> 16) & 0xFF] + bits_cnt[(v >> 24) & 0xFF];
}
bool check(const vector<int>& a) {
  if (count((a).begin(), (a).end(), -1) == 0)
    return is_sorted((a).begin(), (a).end());
  return false;
}
int check_not_worse(int val, vector<int>& a, int pos) {
  auto tmp = a[pos];
  a[pos] = val;
  for (int i = 0, p = -1; i < a.size() && i - 5 < pos; ++i) {
    if (a[i] >= 0) {
      if (p == -1) {
        p = i;
      } else {
        if (a[p] > a[i]) {
          a[pos] = tmp;
          return 2;
        }
        p = i;
      }
    }
  }
  a[pos] = tmp;
  return a[pos] == -1 ? 0 : 1;
}
int get_next(vector<int>& nums) {
  auto v = ni();
  return v;
}
int estimate(int n, int c, int v) {
  auto b = int(1. * (v - 1) * n / c);
  if (v == c && b + 1 != n) return n - 1;
  return b;
}
int main() {
  init_streams();
  init_data();
  auto n = ni(), m = ni(), c = ni();
  vector<int> a(n, -1);
  vector<int> nums{1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
  int step = 0;
  while (step++ < m) {
    auto p = get_next(nums);
    auto ex_p = estimate(n, c, p);
    auto idx = -1, dist = 1000000, check_val = 2;
    for (int i = 0; i < n; ++i) {
      auto ch = check_not_worse(p, a, i);
      if (ch != 2 && ch <= check_val) {
        if (ch == check_val) {
          if (abs(i - ex_p) < dist) {
            idx = i;
            dist = abs(i - ex_p);
          }
        } else {
          idx = i;
          check_val = ch;
          dist = abs(i - ex_p);
        }
      }
    }
    a[idx] = p;
    printf("%i\n", idx + 1);
    fflush(stdout);
    if (check(a)) {
      break;
    }
  }
  return 0;
}
