#include <bits/stdc++.h>
using namespace std;
int N, P, K, M, a, b;
vector<pair<int, int>> S;
vector<pair<int, pair<int, int>>> V;
int main() {
  cin >> N >> P >> K;
  for (int i = 1; i < N + 1; i++) {
    cin >> a >> b;
    V.push_back(make_pair(-b, make_pair(a, i)));
  }
  sort(V.begin(), V.end());
  for (int i = 0; i < N - P + K; i++)
    S.push_back(make_pair(-V[i].second.first, i));
  sort(S.begin(), S.end());
  for (int i = 0; i < K; i++)
    cout << V[S[i].second].second.second << " ", M = max(M, S[i].second);
  for (int i = M + 1; i < M + 1 + P - K; i++) cout << V[i].second.second << " ";
}
