#include <bits/stdc++.h>
using namespace std;
int n;
int p, k;
struct prikaz {
  long long vol;
  long long gnev;
  int nom;
};
prikaz a[100003];
prikaz b[100003];
void radixsort(prikaz *a, prikaz *b, int n) {
  int i, j;
  int k = 2;
  for (i = 0; i < k; i++) {
    int c[65536] = {0};
    for (j = 0; j < n; j++) c[(a[j].gnev >> (16 * i)) & 65535]++;
    for (j = 1; j < 65536; j++) c[j] += c[j - 1];
    for (j = n - 1; j > -1; j--) b[--c[(a[j].gnev >> (16 * i)) & 65535]] = a[j];
    for (j = 0; j < n; j++) a[j] = b[j];
  }
}
void mergesort(prikaz *a, prikaz *b, int l, int r) {
  int i, i0, i1, iRight, iEnd, width, j;
  for (width = 1; width < r - l; width *= 2)
    for (i = l; i < r; i += width * 2) {
      i0 = i;
      i1 = iRight = min(i + width, r);
      iEnd = min(i + width * 2, r);
      for (j = i; j < iEnd; j++)
        if (i0 < iRight && (i1 == iEnd || a[i0].vol >= a[i1].vol))
          b[j] = a[i0++];
        else
          b[j] = a[i1++];
      for (j = i; j < iEnd; j++) a[j] = b[j];
    }
}
void mergesort2(prikaz *a, prikaz *b, int l, int r) {
  int i, i0, i1, iRight, iEnd, width, j;
  for (width = 1; width < r - l; width *= 2)
    for (i = l; i < r; i += width * 2) {
      i0 = i;
      i1 = iRight = min(i + width, r);
      iEnd = min(i + width * 2, r);
      for (j = i; j < iEnd; j++)
        if (i0 < iRight && (i1 == iEnd || a[i0].gnev >= a[i1].gnev))
          b[j] = a[i0++];
        else
          b[j] = a[i1++];
      for (j = i; j < iEnd; j++) a[j] = b[j];
    }
}
int coun;
int d[100003];
int main() {
  scanf("%d %d %d", &n, &p, &k);
  int i, j;
  for (i = 0; i < n; i++) {
    scanf("%d %d", &a[i].vol, &a[i].gnev);
    a[i].nom = i + 1;
  }
  radixsort(a, b, n);
  i = 0;
  while (i < n) {
    j = i;
    while (a[j].gnev == a[i].gnev && j < n) j++;
    mergesort(a, b, i, j);
    i = j;
  }
  mergesort(a, b, p - k, n);
  i = p - k;
  while (i < n) {
    j = i;
    while (a[j].vol == a[i].vol && j < n) j++;
    mergesort2(a, b, i, j);
    i = j;
  }
  int mini = 1000000001;
  for (i = p - k; coun < k; i++) {
    coun++;
    d[a[i].nom - 1] = 2;
    mini = min(mini, (int)a[i].gnev);
  }
  int mini2 = 1000000001;
  for (i = p - k; i < p; i++)
    if (a[i].gnev == mini) mini2 = min(mini2, (int)a[i].vol);
  mergesort2(a, b, 0, n);
  i = 0;
  while (i < n) {
    j = i;
    while (a[j].gnev == a[i].gnev && j < n) j++;
    mergesort(a, b, i, j);
    i = j;
  }
  for (i = 0; i < n && coun < p; i++)
    if (d[a[i].nom - 1] != 2 &&
        (a[i].gnev < mini || (a[i].gnev == mini && a[i].vol >= mini2))) {
      d[a[i].nom - 1] = 2;
      coun++;
    }
  int coun2 = 0;
  for (i = n - 1; i > -1 && coun2 < p; i--) {
    if (d[a[i].nom - 1] == 2 && coun2 == 0) {
      coun2++;
      printf("%d", a[i].nom);
    } else if (d[a[i].nom - 1] == 2) {
      coun2++;
      printf(" %d", a[i].nom);
    }
  }
  printf("\n");
  return 0;
}
