#include <bits/stdc++.h>
using namespace std;
int ind2[100100];
struct order {
  int greyhair;
  int displeasment;
  int ind;
  bool operator<(const order &an) const {
    if (greyhair != an.greyhair) return greyhair > an.greyhair;
    return ind2[ind] > ind2[an.ind];
  }
};
order Orders[100010];
bool displeasmentSort(const order &a, const order &b) {
  if (a.displeasment != b.displeasment) return a.displeasment < b.displeasment;
  if (a.greyhair != b.greyhair) return a.greyhair > b.greyhair;
  return a.ind < b.ind;
}
set<order> all, obey;
int main() {
  int n, p, k;
  scanf("%d %d %d", &n, &p, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &Orders[i].greyhair, &Orders[i].displeasment);
    Orders[i].ind = i;
  }
  sort(Orders + 1, Orders + n + 1, displeasmentSort);
  for (int i = 1; i <= n; i++) ind2[Orders[i].ind] = i;
  for (int i = p - k + 1; i <= n; i++) all.insert(Orders[i]);
  int i = 0;
  for (set<order>::iterator it = all.begin(); it != all.end() && i < k;
       it++, i++) {
    obey.insert(*it);
  }
  for (i = p - k + 1; obey.count(Orders[i]) == 0; i++) {
  }
  for (int c = i - (p - k); c < i; c++) printf("%d ", Orders[c].ind);
  for (set<order>::iterator it = obey.begin(); it != obey.end(); it++)
    printf("%d ", (*it).ind);
}
