#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second < b.first.second) return 1;
  if (a.first.second == b.first.second && a.first.first > b.first.first)
    return 1;
  return 0;
}
bool cmp1(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.second > b.first.second;
}
int main() {
  int n, p, k;
  while (cin >> n >> p >> k) {
    int appro[100020] = {0}, last = 0;
    vector<pair<pair<int, int>, int> > vec(n), vec1, vec2;
    for (int i = 0; i < n; i++) {
      cin >> vec[i].first.first >> vec[i].first.second;
      vec[i].second = i;
    }
    vec1 = vec;
    sort(vec.begin(), vec.end(), cmp);
    for (int i = 0; i < p - k; i++) vec1[i] = vec[i];
    for (int i = p - k; i < n; i++) vec2.push_back(vec[i]);
    sort(vec2.rbegin(), vec2.rend());
    for (int i = 0; i < k; i++)
      cout << vec2[i].second + 1 << " ", appro[vec2[i].second] = 1;
    for (int i = p - k; i < n; i++) {
      if (!appro[vec[i].second])
        vec1[i] = vec[i], last++;
      else
        break;
    }
    sort(vec1.begin(), vec1.begin() + last + p - k, cmp1);
    for (int i = 0; i < p - k; i++) cout << vec1[i].second + 1 << " ";
    cout << endl;
  }
}
