#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long maxn = 3e6;
const long long mod = 1e9 + 7;
const long double PI = acos((long double)-1);
long long pw(long long a, long long b, long long md = mod) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (a * res) % md;
    }
    a = (a * a) % md;
    b >>= 1;
  }
  return (res);
}
int n, m, c;
int a[maxn];
bool chk() {
  a[0] = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] < a[i - 1]) return (0);
  return (1);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> c;
  memset(a, -1, sizeof a);
  ;
  while (1) {
    int k;
    cin >> k;
    if (k <= c / 2) {
      for (int i = 1; i <= n; i++)
        if (a[i] == -1 or k < a[i]) {
          a[i] = k;
          cout << i << endl;
          break;
        }
    } else
      for (int i = n; i > 0; i--)
        if (a[i] == -1 or k > a[i]) {
          a[i] = k;
          cout << i << endl;
          break;
        }
    if (chk()) return (0);
  }
  return (0);
}
