#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, p, k;
long long sum, ans, bns, idx, s[N];
struct node {
  long long x, y, id;
} a[N];
multiset<pair<int, int> > se;
bool cmp1(node a, node b) { return a.y == b.y ? a.x < b.x : a.y > b.y; }
int main() {
  scanf("%d%d%d", &n, &p, &k), k = p - k;
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y), a[i].id = i;
  sort(a + 1, a + n + 1, cmp1);
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i].y;
  for (int i = 1; i <= p - k; i++)
    se.insert(make_pair(a[i].x, a[i].id)), sum += a[i].x;
  for (int i = p - k + 1; i <= n - k + 1; i++) {
    long long res = (s[i + k - 1] - s[i - 1]);
    if (sum > bns || sum == bns && res > ans) {
      ans = res, bns = sum;
      idx = i;
    }
    if (p != k && (*se.begin()).first < a[i].x) {
      sum -= (*se.begin()).first - a[i].x;
      se.erase(se.begin()), se.insert(make_pair(a[i].x, a[i].id));
    }
  }
  se.clear();
  for (int i = 1; i <= p - k; i++)
    se.insert(make_pair(a[i].x, a[i].id)), sum += a[i].x;
  for (int i = p - k + 1; i <= idx; i++) {
    if (p != k && i < idx && (*se.begin()).first < a[i].x) {
      se.erase(se.begin()), se.insert(make_pair(a[i].x, a[i].id));
    }
  }
  for (int i = idx; i <= idx + k - 1; i++) printf("%d ", a[i].id);
  for (set<pair<int, int> >::iterator it = se.begin(); it != se.end(); it++)
    printf("%d ", (*it).second);
  printf("\n");
}
