#include <bits/stdc++.h>
using namespace std;
long long modpow(long long x, long long p, long long M) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = ret * x % M;
    x = x * x % M;
    p /= 2;
  }
  return ret;
}
vector<pair<pair<long long, long long>, long long> > a;
long long sum[100010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, p, k;
  cin >> n >> p >> k;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a.push_back(make_pair(make_pair(y, -x), i + 1));
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  set<pair<long long, long long> > s;
  long long ans = -1, val = 0, idx = -1;
  for (int i = 0; i < k; i++)
    s.insert(make_pair(-a[i].first.second, a[i].second)),
        val -= a[i].first.second;
  sum[n] = 0;
  for (int i = n - 1; i >= 0; i--) sum[i] = sum[i + 1] + a[i].first.first;
  for (int i = k; i + p - k <= n; i++) {
    if (val > ans) {
      ans = val;
      idx = i;
    } else if (val == ans &&
               sum[i] - sum[i + p - k] > sum[idx] - sum[idx + p - k])
      idx = i;
    pair<long long, long long> x = make_pair(-a[i].first.second, a[i].second);
    if (x > *s.begin()) {
      val -= s.begin()->first;
      s.erase(s.begin());
      val += x.first;
      s.insert(x);
    }
  }
  s.clear();
  for (int i = 0; i < idx; i++) {
    if (s.size() < k)
      s.insert(make_pair(-a[i].first.second, a[i].second));
    else if (-a[i].first.second > s.begin()->first) {
      s.erase(s.begin());
      s.insert(make_pair(-a[i].first.second, a[i].second));
    }
  }
  vector<int> A;
  for (auto it = s.begin(); it != s.end(); it++) A.push_back(it->second);
  for (int i = idx; i < idx + p - k; i++) A.push_back(a[i].second);
  sort(A.begin(), A.end());
  for (int i = 0; i < A.size(); i++) cout << A[i] << " ";
  cout << "\n";
  return 0;
}
