#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p, k;
  cin >> n >> p >> k;
  vector<pair<int, int> > pts(n);
  for (int i = 0; i < n; i++) cin >> pts[i].first >> pts[i].second;
  vector<pair<pair<int, int>, int> > disp;
  for (int i = 0; i < n; i++)
    disp.push_back(make_pair(make_pair(pts[i].second, -pts[i].first), i));
  sort(disp.begin(), disp.end());
  int rem = p - k;
  vector<long long> sum(n, 0);
  for (int i = 1; i < n; i++) sum[i] = sum[i - 1] + disp[i - 1].first.first;
  priority_queue<int> Q;
  long long greys = 0;
  for (int i = n - 1; i >= n - k; i--) {
    Q.push(disp[i].first.second);
    greys -= disp[i].first.second;
  }
  pair<long long, long long> ans(greys, sum[n - k] - sum[n - k - rem]);
  int index = n - k;
  for (int i = n - k; i >= rem; i--) {
    pair<long long, long long> temp(greys, sum[i] - sum[i - rem]);
    if (temp > ans) {
      index = i;
      ans = temp;
    }
    if (i > 0) {
      int v = disp[i - 1].first.second;
      if (v < Q.top()) {
        int diff = v - Q.top();
        Q.pop();
        greys -= diff;
        Q.push(v);
      }
    }
  }
  for (int i = index - rem; i < index; i++) cout << disp[i].second + 1 << " ";
  vector<pair<int, int> > final;
  for (int i = index; i < n; i++) {
    final.push_back(make_pair(-disp[i].first.second, disp[i].second));
  }
  sort(final.rbegin(), final.rend());
  for (int i = 0; i < k; i++) cout << final[i].second + 1 << " ";
  cout << endl;
  return 0;
}
