#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
int fi, la;
int n, p, k;
int ans[N];
struct node {
  int x, y, id, now;
  bool operator<(const node a) const {
    return y > a.y || (y == a.y && x > a.x);
  }
} a[N], mn1, mn2;
priority_queue<node> q;
bool cmp(node a, node b) { return a.x < b.x || (a.x == b.x && a.y > b.y); }
int main() {
  scanf("%d%d%d", &n, &p, &k);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].y, &a[i].x), a[i].id = i;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) a[i].now = i;
  for (int i = p - k + 1; i <= p; i++) q.push(a[i]), ans[a[i].id] = 1;
  fi = p - k + 1;
  for (la = p + 1; la <= n; la++) {
    ans[a[la].id] = 1;
    q.push(a[la]);
    ans[q.top().id] = 0;
    q.pop();
  }
  for (int i = 1; i <= n; i++)
    if (ans[a[i].id]) {
      for (int j = i - 1; j >= i - p + k; j--) ans[a[j].id] = 1;
      break;
    }
  for (int i = 1; i <= n; i++)
    if (ans[i]) printf("%d ", i);
  return 0;
}
