#include <bits/stdc++.h>
using namespace std;
int ri() {
  int r;
  cin >> r;
  return r;
}
unsigned int rui() {
  unsigned int r;
  cin >> r;
  return r;
}
long long rl() {
  long long r;
  cin >> r;
  return r;
}
unsigned long long rul() {
  unsigned long long r;
  cin >> r;
  return r;
}
double rd() {
  double r;
  cin >> r;
  return r;
}
string rss() {
  string r;
  cin >> r;
  return r;
}
string rs() {
  string r;
  getline(cin, r);
  return r;
}
vector<string> rvs(int n) {
  assert(n);
  vector<string> r;
  for (int i = 0; i < n; ++i) {
    string s = rs();
    while (s.empty()) s = rs();
    r.push_back(s);
  }
  return r;
}
vector<int> rvi(int n) {
  assert(n);
  vector<int> r;
  for (int i = 0; i < n; ++i) r.push_back(ri());
  return r;
}
vector<unsigned int> rvui(int n) {
  assert(n);
  vector<unsigned int> r;
  for (int i = 0; i < n; ++i) r.push_back(rui());
  return r;
}
vector<long long> rvl(int n) {
  assert(n);
  vector<long long> r;
  for (int i = 0; i < n; ++i) r.push_back(rl());
  return r;
}
vector<unsigned long long> rvul(int n) {
  assert(n);
  vector<unsigned long long> r;
  for (int i = 0; i < n; ++i) r.push_back(rul());
  return r;
}
vector<double> rvd(int n) {
  assert(n);
  vector<double> r;
  for (int i = 0; i < n; ++i) r.push_back(rd());
  return r;
}
int main() {
  int n = ri(), p = ri(), k = ri();
  vector<tuple<int, int, int> > v;
  for (int i = 0; i < n; ++i) {
    int t1 = ri(), t2 = ri();
    v.push_back(tuple<int, int, int>(t1, t2, i + 1));
  }
  sort(v.begin(), v.end(),
       [](tuple<int, int, int> p1, tuple<int, int, int> p2) -> bool {
         if (get<1>(p1) != get<1>(p2)) return get<1>(p1) < get<1>(p2);
         return get<0>(p1) > get<0>(p2);
       });
  int bi = n - k;
  multimap<int, int> m;
  for (int i = n - 1; i >= p - k; --i) {
    if (m.size() < k)
      m.insert(pair<int, int>(get<0>(v[i]), get<2>(v[i])));
    else {
      if (m.begin()->first < get<0>(v[i])) {
        m.erase(m.begin());
        m.insert(pair<int, int>(get<0>(v[i]), get<2>(v[i])));
        bi = i;
      }
    }
  }
  for (auto it = m.begin(); it != m.end(); ++it) cout << it->second << " ";
  for (int i = 0, j = bi - 1; i < p - k; ++i, --j) cout << get<2>(v[j]) << " ";
  cout << endl;
  return 0;
}
