#include <bits/stdc++.h>
using namespace std;
struct T {
  int grey, disp, Rank, n;
} vote[100000];
bool cmp1(T a, T b) {
  if (a.disp == b.disp)
    return (a.grey > b.grey);
  else
    return (a.disp < b.disp);
}
bool cmp2(T a, T b) {
  if (a.grey == b.grey)
    return (a.disp > b.disp);
  else
    return (a.grey > b.grey);
}
bool cmp3(T a, T b) { return (a.Rank < b.Rank); }
int main() {
  ios::sync_with_stdio(false);
  int n, p, k;
  cin >> n >> p >> k;
  for (int i = 0; i != n; ++i) {
    cin >> vote[i].grey >> vote[i].disp;
    vote[i].n = i + 1;
  }
  sort(vote, vote + n, cmp1);
  for (int i = 0; i != n; ++i) vote[i].Rank = i + 1;
  sort(vote, vote + n, cmp2);
  int i1 = 0;
  int cnt1 = 0;
  int end1 = k;
  int end2 = p - k;
  int Rmin = 1e9 + 7;
  while (cnt1 < end1) {
    if (vote[i1].Rank > end2) {
      ++cnt1;
      cout << vote[i1].n << ' ';
      Rmin = min(Rmin, vote[i1].Rank);
      vote[i1].n = -1;
    }
    ++i1;
  }
  sort(vote, vote + n, cmp3);
  int i2 = Rmin - 1 - 1;
  int cnt2 = 0;
  while (cnt2 < end2) {
    ++cnt2;
    cout << vote[i2].n << ' ';
    --i2;
  }
}
