#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
const long long int mod = 1e9 + 7;
long long int n, k, p;
vector<pair<long long int, pair<long long int, long long int> > > v, w;
vector<pair<long long int,
            pair<long long int, pair<long long int, long long int> > > >
    u;
bool cmp(pair<long long int, pair<long long int, long long int> > a,
         pair<long long int, pair<long long int, long long int> > b) {
  if (a.second.second > b.second.second) {
    return true;
  }
  if (a.second.second == b.second.second) {
    return a.second.first < b.second.first;
  }
  return false;
}
bool cmp2(pair<long long int,
               pair<long long int, pair<long long int, long long int> > >
              a,
          pair<long long int,
               pair<long long int, pair<long long int, long long int> > >
              b) {
  if (a.second.first > b.second.first) {
    return true;
  }
  if (a.second.first == b.second.first) {
    return a.second.second.first > b.second.second.first;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  long long int x, y, z;
  cin >> n >> p >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(i, make_pair(x, y)));
  }
  sort(v.begin(), v.end(), cmp);
  for (long long int i = 0; i < n - (p - k); i++) {
    x = v[i].first;
    y = v[i].second.first;
    z = v[i].second.second;
    u.push_back(make_pair(x, make_pair(y, make_pair(z, i))));
  }
  long long int mx_index = 0;
  sort(u.begin(), u.end(), cmp2);
  for (long long int i = 0; i < k; i++) {
    cout << u[i].first + 1 << " ";
    mx_index = max(mx_index, u[i].second.second.second);
  }
  long long int cnt = 0;
  for (long long int i = 0; i < v.size(); i++) {
    if (i <= mx_index) {
      continue;
    }
    if (cnt < (p - k)) {
      cnt++;
      cout << v[i].first + 1 << " ";
    }
  }
  cout << endl;
  return 0;
}
