#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 10;
struct order {
  long long num, a, b;
} f[maxn];
bool cmp(order x, order y) {
  if (x.b != y.b) return x.b < y.b;
  return x.a > y.a;
}
map<long long, long long> ms;
priority_queue<long long, vector<long long>, greater<long long>> st;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, p, k;
  cin >> n >> p >> k;
  for (int i = (1); i < (n + 1); ++i) {
    cin >> f[i].a >> f[i].b;
    f[i].num = i;
  }
  sort(f + 1, f + n + 1, cmp);
  long long mx, pos, sum = 0;
  for (int i = (n + 1 - k); i < (n + 1); ++i) {
    st.push(f[i].a);
    sum += f[i].a;
  }
  pos = n - k;
  mx = sum;
  for (int i = (n - k) - 1; i >= (p - k); --i) {
    if (f[i + 1].a > st.top()) {
      sum += f[i + 1].a - st.top();
      st.pop();
      st.push(f[i + 1].a);
      if (mx < sum) {
        mx = sum;
        pos = i;
      }
    }
  }
  sort(f + pos + 1, f + n + 1, [&](order x, order y) { return x.a > y.a; });
  for (int i = (pos + 1); i < (pos + k + 1); ++i) cout << f[i].num << ' ';
  for (int i = (pos + 1) - 1; i >= (pos - (p - k) + 1); --i)
    cout << f[i].num << ' ';
  return 0;
}
