#include <bits/stdc++.h>
using namespace std;
bool debug = false;
long long n, k, p;
struct faq_data_myson_zjs_is_not_here_a_system_reserver {
  long long g, d, i;
};
faq_data_myson_zjs_is_not_here_a_system_reserver order[100005];
faq_data_myson_zjs_is_not_here_a_system_reserver tmp[100005];
bool cmp(faq_data_myson_zjs_is_not_here_a_system_reserver a,
         faq_data_myson_zjs_is_not_here_a_system_reserver b) {
  if (a.d != b.d) {
    return a.d > b.d;
  }
  if (a.g != b.g) {
    return a.g < b.g;
  }
  return a.i < b.i;
}
template <typename T>
struct pq_small {
  priority_queue<T, vector<T>, greater<T> > pq;
  void push(T x) { pq.push(x); }
  void pop() { pq.pop(); }
  int size() { return pq.size(); }
  bool empty() { return pq.empty(); }
  T top() { return pq.top(); }
};
bool cmp2(faq_data_myson_zjs_is_not_here_a_system_reserver a,
          faq_data_myson_zjs_is_not_here_a_system_reserver b) {
  if (a.g != b.g) {
    return a.g > b.g;
  }
  if (a.d != b.d) {
    return a.d < b.d;
  }
  return a.i < b.i;
}
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(0);
  cin >> n >> p >> k;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    order[i].g = a;
    order[i].d = b;
    order[i].i = i;
  }
  sort(order, order + n, cmp);
  pq_small<pair<long long, long long> > front;
  long long fsum = 0;
  for (int i = 0; i < k; i++) {
    fsum += order[i].g;
    front.push(make_pair(order[i].g, i));
  }
  long long bsum = 0;
  for (int i = k; i < p; i++) {
    bsum += order[i].d;
  }
  pair<long long, long long> best = make_pair(fsum, bsum);
  int bestpos = k - 1;
  for (int i = k; i + p - k < n; i++) {
    fsum += order[i].g;
    front.push(make_pair(order[i].g, i));
    fsum -= front.top().first;
    front.pop();
    bsum -= order[i].d;
    bsum += order[i + p - k].d;
    if (make_pair(fsum, bsum) > best) {
      best = make_pair(fsum, bsum);
      bestpos = i;
    }
  }
  sort(order, order + bestpos + 1, cmp2);
  for (int i = 0; i < k; i++) {
    cout << order[i].i + 1 << " ";
  }
  for (int i = bestpos + 1; i - (bestpos + 1) < p - k; i++) {
    cout << order[i].i + 1 << " ";
  }
  return 0;
}
