#include <bits/stdc++.h>
using namespace std;
const int MAX_MEM = 1e8;
int mpos = 0;
char mem[MAX_MEM];
inline void *operator new(size_t n) {
  assert((mpos += n) <= MAX_MEM);
  return (void *)(mem + mpos - n);
}
inline void operator delete(void *) noexcept {}
void write(pair<pair<int, int>, int> a) {
  cout << a.first.first << ' ' << a.first.second << ' ' << a.second << '\n';
  ;
}
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  if (a.first.second > b.first.second)
    return true;
  else if (a.first.second == b.first.second && a.first.first < b.first.first)
    return true;
  else
    return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, p, k;
  cin >> n >> p >> k;
  pair<pair<int, int>, int> a[n];
  int b[n];
  set<pair<pair<int, int>, int> > s;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = {{x, y}, i};
  }
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) b[a[i].second] = i;
  int pos = 0;
  for (int i = 0; i < n - p + k; i++) s.insert(a[i]);
  auto j = --s.end();
  for (int i = 0; i < k; i++) {
    cout << j->second + 1 << ' ';
    pos = max(pos, b[j->second]);
    j--;
  }
  for (int i = pos + 1; i <= pos + p - k; i++) cout << a[i].second + 1 << ' ';
  return 0;
}
