#include <bits/stdc++.h>
using namespace std;
const int N = (int)(1e5 + 5);
typedef struct {
  int x, y, i;
} S1;
typedef struct {
  int x, j;
} S2;
S1 a[N];
S2 b[N];
int asr[N], ia;
int cpr1(const void *a, const void *b) {
  S1 *c = (S1 *)a;
  S1 *d = (S1 *)b;
  if (c->y != d->y)
    return d->y - c->y;
  else
    return c->x - d->x;
}
int cpr2(const void *a, const void *b) {
  S2 *c = (S2 *)a;
  S2 *d = (S2 *)b;
  if (c->x != d->x)
    return d->x - c->x;
  else
    return c->j - d->j;
}
int main() {
  int i, j, k, n, m, p;
  cin >> n >> p >> k;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    a[i].i = i;
  }
  qsort(a, n, sizeof(a[0]), cpr1);
  m = n - (p - k);
  for (i = 0; i < m; i++) {
    b[i].x = a[i].x;
    b[i].j = i;
  }
  qsort(b, m, sizeof(b[0]), cpr2);
  ia = 0;
  j = -1;
  for (i = 0; i < m; i++) {
    asr[ia++] = a[b[i].j].i + 1;
    if (b[i].j > j) j = b[i].j;
    if (ia == k) break;
  }
  for (i = j + 1; i < n; i++) {
    asr[ia++] = a[i].i + 1;
    if (ia == p) break;
  }
  cout << asr[0];
  for (i = 1; i < p; i++) printf(" %d", asr[i]);
  cout << endl;
}
