#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long MAX = 1e17;
int a[100001];
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int n, m, c, x;
  cin >> n >> m >> c;
  int start = n / 2, end = n / 2 - 1;
  bool f = 0, s = 0;
  while (m--) {
    cin >> x;
    bool h = 0;
    if (x <= c / 2) {
      for (int i = 0; i <= end; ++i) {
        if (f) {
          if (a[i] > x) {
            a[i] = x;
            h = 1;
            cout << i + 1 << '\n';
            ;
            break;
          }
        } else {
          if (a[i] >= x) {
            h = 1;
            if (i == 0) {
              a[0] = x, cout << 1 << '\n';
              ;
            } else {
              if (i == 1) f = 1;
              a[i - 1] = x;
              cout << i << '\n';
              ;
            }
            break;
          }
        }
      }
      if (!h) {
        if (!f) {
          a[end] = x;
          if (end == 0) f = 1;
          cout << end + 1 << '\n';
          ;
        } else {
          if (a[start] == 0) {
            a[start] = x;
            cout << start + 1 << '\n';
            ;
            if (n == 2) s = 1;
            end = start;
            start++;
            if (start == n) {
              return 0;
            }
          } else {
            for (int i = start; i < n; ++i) {
              if (i == n - 1) {
                cout << n << '\n';
                ;
                return 0;
              }
              if (a[i] == 0) {
                a[i] = x;
                cout << i + 1 << '\n';
                ;
                if (a[i + 1] != 0) s = 1;
                end = i;
                start = i + 1;
              }
              if (a[i] > x) {
                a[i] = x;
                cout << i + 1 << '\n';
                ;
                end = i;
                start = i + 1;
              }
            }
          }
        }
      }
    } else {
      for (int i = start; i < n; ++i) {
        if (s) {
          if (a[i] >= x) {
            if (i == start) {
              if (n == 3) {
                cout << 1 << '\n';
                ;
                return 0;
              }
              start--;
              end--;
              if (start <= 0) f = 1;
            }
            a[i - 1] = x;
            h = 1;
            cout << i << '\n';
            ;
            break;
          }
        } else {
          if (a[i] >= x) {
            h = 1;
            if (i == start) {
              a[start] = x, cout << start << '\n';
              ;
            }
            if (i == start + 1) {
              s = 1;
            }
            a[i - 1] = x;
            cout << i << '\n';
            ;
            break;
          }
        }
      }
      if (!h) {
        if (!s) {
          a[n - 1] = x;
          if (n == 2) s = 1;
          cout << n << '\n';
          ;
        } else {
          if (a[n - 1] == 0) {
            a[end] = x;
            if (n == 2) s = 1;
            cout << end + 1 << '\n';
            ;
            if (end == 0) return 0;
          } else {
            a[n - 1] = x;
            cout << n << '\n';
            ;
          }
        }
      }
    }
    fflush(stdout);
    if (f)
      if (s) return 0;
  }
  return 0;
}
