#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1, maxn = 1000000 + 10;
int n, p, k;
int num[maxn];
long long a[maxn], b[maxn];
void setIO(string name) {}
int gI() {
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  int p = 0, flag = 1;
  if (c == '-') flag = -1, c = getchar();
  while (c >= '0' && c <= '9') p = p * 10 + c - '0', c = getchar();
  return p * flag;
}
bool cmp(int x, int y) {
  return (b[x] > b[y] || (b[x] == b[y] && a[x] < a[y]));
}
bool cmp2(int x, int y) {
  return (a[x] > a[y] || (a[x] == a[y] && b[x] > b[y]));
}
int main() {
  scanf("%d %d %d", &n, &p, &k);
  for (int i = 0; i < n; ++i) num[i] = i;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
  sort(num, num + n, cmp);
  sort(num, num + (n - p + k), cmp2);
  bool v[maxn];
  memset(v, 0, sizeof(v));
  for (int i = 0; i < k; ++i) {
    printf("%d ", num[i] + 1);
    v[num[i]] = true;
  }
  v[n + 10] = true;
  for (int i = 0; i < n; ++i) num[i] = i;
  sort(num, num + n, cmp);
  for (int i = n - 1; i >= 0; --i)
    if (v[num[i]]) {
      for (int j = i + 1; j <= i + p - k; ++j) {
        printf("%d", num[j] + 1);
        if (j == i + p - k)
          printf("\n");
        else
          printf(" ");
      }
      break;
    }
  return 0;
}
