#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  long long n, p, k;
  cin >> n >> p >> k;
  vector<pair<pair<long long, long long>, long long> > v(n);
  for (long long i = 0; i < n; i++) {
    long long p, q;
    cin >> p >> q;
    v[i] = {{-q, p}, i};
  }
  sort(v.rbegin(), v.rend());
  for (long long i = 0; i < n; i++) {
    long long a = v[i].first.second, b = -v[i].first.first;
    v[i] = {{a, b}, v[i].second};
  }
  vector<long long> prefB(n);
  prefB[0] = v[0].first.second;
  for (long long i = 1; i < n; i++) prefB[i] = prefB[i - 1] + v[i].first.second;
  vector<pair<long long, long long> > t(n);
  for (long long i = 0; i < n; i++) t[i] = {v[i].first.first, i};
  sort(t.begin(), t.end());
  for (long long i = 0; i < n; i++) t[i] = {t[i].second, i};
  sort(t.begin(), t.end());
  vector<long long> arr(n);
  long long sum = 0;
  for (long long i = n - k + 1; i < n; i++) {
    arr[t[i].second] = v[i].first.first;
    sum += v[i].first.first;
  }
  long long left;
  for (long long i = 0; i < n; i++) {
    if (arr[i]) {
      left = i;
      break;
    }
  }
  long long resA = 0, resB, respos;
  for (long long i = n - k; i >= p - k; i--) {
    long long sumA = sum + v[i].first.first;
    long long sumB = 0;
    if (i - 1 >= 0) sumB += prefB[i - 1];
    if (i - p + k - 1 >= 0) sumB -= prefB[i - p + k - 1];
    if (sumA > resA || (sumA == resA && sumB > resB)) {
      resA = sumA;
      resB = sumB;
      respos = i;
    }
    long long pos = t[i].second;
    if (pos > left) {
      arr[pos] = v[i].first.first;
      sum = sum - arr[left] + v[i].first.first;
      left++;
      while (arr[left] == 0) left++;
    }
  }
  sort(v.begin() + (respos + 1), v.end());
  for (long long i = respos - p + k; i <= respos; i++)
    cout << v[i].second + 1 << ' ';
  for (long long i = n - k + 1; i < n; i++) cout << v[i].second + 1 << ' ';
  return 0;
}
