#include <bits/stdc++.h>
using namespace std;
int n, k, p;
pair<pair<int, int>, int> num[200099];
int posicion[200099];
bool mk[200099];
vector<int> answer;
int cmp1(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second != b.first.second) return a.first.second < b.first.second;
  if (a.first.first != b.first.first) return a.first.first > b.first.first;
  return a.second < b.second;
}
int cmp2(int a, int b) {
  if (num[a].first.first != num[b].first.first)
    return num[a].first.first < num[b].first.first;
  else
    return num[a].first.second < num[b].first.second;
}
int main() {
  cin >> n >> k >> p;
  for (int i = 0; i < n; i++) {
    cin >> num[i].first.first >> num[i].first.second;
    num[i].second = i;
  }
  sort(num, num + n, cmp1);
  for (int i = 0; i < n; i++) posicion[i] = i;
  sort(posicion + k - p, posicion + n, cmp2);
  sort(num + k - p, num + n);
  int m = n;
  for (int i = n - 1; i >= n - p; i--) {
    answer.push_back(num[i].second);
    mk[num[i].second] = true;
    m = min(m, posicion[i]);
  }
  sort(num, num + n, cmp1);
  int cant = k - p;
  for (int i = m - 1; i >= 0 && cant; i--) {
    if (!mk[num[i].second]) {
      answer.push_back(num[i].second);
      cant--;
    }
  }
  sort(answer.begin(), answer.end());
  for (int i = 0; i < answer.size() - 1; i++) cout << answer[i] + 1 << " ";
  cout << answer[answer.size() - 1] + 1 << endl;
  return 0;
}
