#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long N = 1e5 + 4;
pair<pair<long long, long long>, long long> a[N];
long long ps[N];
multiset<long long> st;
void solve() {
  long long n, p, k;
  cin >> n >> p >> k;
  for (long long i = 1; i < n + 1; ++i) {
    cin >> a[i].first.second >> a[i].first.first;
    a[i].first.first *= -1;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  for (long long i = 1; i < n + 1; ++i) {
    ps[i] = ps[i - 1] - a[i].first.first;
  }
  long long s = 0;
  for (long long i = 1; i < k + 1; ++i) {
    s += a[i].first.second;
    st.insert(a[i].first.second);
  }
  pair<pair<long long, long long>, long long> ans =
      make_pair(make_pair(s, ps[p] - ps[k]), k);
  for (long long i = k + 1; i < n - p + k + 1; ++i) {
    st.insert(a[i].first.second);
    s += a[i].first.second;
    s -= *st.begin();
    st.erase(st.begin());
    ans = max(ans, make_pair(make_pair(s, ps[i + p - k] - ps[i]), i));
  }
  long long idx = ans.second;
  for (long long i = 1; i < idx + 1; ++i) {
    swap(a[i].first.first, a[i].first.second);
    a[i].first.first *= -1;
    a[i].first.second *= -1;
  }
  sort(a + 1, a + idx + 1);
  for (long long i = 1; i < k + 1; ++i) {
    cout << a[i].second << ' ';
  }
  for (long long i = idx + 1; i < idx + p - k + 1; ++i) {
    cout << a[i].second << ' ';
  }
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
