#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> ord[100005];
int used[100005] = {};
bool comp1(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second == b.first.second) {
    if (a.first == b.first) return a.second < b.second;
    return a.first.first > b.first.first;
  }
  return a.first.second < b.first.second;
}
bool comp2(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.first == b.first.first) return a.first.second > b.first.second;
  return a.first.first > b.first.first;
}
int main() {
  ios::sync_with_stdio(false);
  int g = 0;
  int n, p, k, x, y, korig;
  cin >> n >> p >> k;
  korig = k;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    ord[i] = pair<pair<int, int>, int>(pair<int, int>(x, y), i);
  }
  sort(ord, ord + n, comp1);
  for (int i = 0; i < p - k; i++) {
    used[ord[i].second] = 1;
  }
  sort(ord, ord + n, comp2);
  for (int i = 0; i < k; i++) {
    if (used[ord[i].second])
      k++;
    else {
      cout << ord[i].second + 1 << ' ';
      used[ord[i].second] = 2;
    }
  }
  sort(ord, ord + n, comp1);
  int i = 0;
  while (used[ord[i].second] < 2) i++;
  i--;
  for (int j = 0; j < p - korig; j++) {
    cout << ord[i - j].second + 1 << ' ';
    if (used[ord[i].second] == 2) return 1;
    if (i - j < 0) return 2;
  }
  cout << endl;
}
