#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int NMAX = 1e6 + 4;
const int mod = 1e9 + 7;
vector<int> a;
int n, m, c;
int main() {
  cin >> n >> m >> c;
  a.assign(n, -1);
  while (true) {
    int p;
    cin >> p;
    p--;
    if (p < c / 2) {
      for (int i = 0; i < n; i++) {
        if (a[i] == -1 || a[i] > p) {
          a[i] = p;
          cout << i + 1 << endl;
          cout.flush();
          break;
        }
      }
    } else {
      for (int i = n - 1; i >= 0; i--) {
        if (a[i] == -1 || a[i] < p) {
          a[i] = p;
          cout << i + 1 << endl;
          cout.flush();
          break;
        }
      }
    }
    bool f = true;
    for (auto k : a)
      if (k == -1) f = false;
    if (f) return 0;
  }
}
