#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
struct node {
  int a, b, id;
} x[maxn];
bool cmp1(node p, node q) {
  if (p.b == q.b) return p.a > q.a;
  return p.b < q.b;
}
bool cmp2(node p, node q) {
  if (p.a == q.a) return p.b > q.b;
  return p.a > q.a;
}
bool cmp3(node p, node q) {
  if (p.b == q.b) return p.a > q.a;
  return p.b > q.b;
}
int n, p, k;
node ans1[maxn], ans2[maxn];
int cnt1, cnt2;
int main() {
  scanf("%d%d%d", &n, &p, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x[i].a, &x[i].b);
    x[i].id = i;
  }
  sort(x + 1, x + n + 1, cmp1);
  for (int i = 1; i <= p - k; i++) {
    ans1[++cnt1] = x[i];
  }
  sort(x + p - k + 1, x + n + 1, cmp2);
  int minb = 1e9, mina = 1e9;
  for (int i = p - k + 1; i <= p; i++) {
    ans2[++cnt2] = x[i];
    if (minb > x[i].b) {
      minb = x[i].b;
      mina = x[i].a;
    }
  }
  for (int i = p + 1; i <= n; i++) {
    ans1[++cnt1] = x[i];
  }
  sort(ans1 + 1, ans1 + cnt1 + 1, cmp3);
  for (int i = 1; i <= cnt1; i++) {
    if (ans1[i].b == minb && ans1[i].a < mina) continue;
    if (ans1[i].b <= minb) {
      ans2[++cnt2] = ans1[i];
      if (cnt2 == p) break;
    }
  }
  for (int i = 1; i <= p; i++) {
    printf("%d%c", ans2[i].id, i == p ? '\n' : ' ');
  }
  return 0;
}
