#include <bits/stdc++.h>
using namespace std;
struct prik {
  int hair, mood, ind;
};
bool comp1(prik a, prik b) {
  if (a.hair != b.hair)
    return a.hair > b.hair;
  else
    return a.mood > b.mood;
}
bool comp2(prik a, prik b) {
  if (a.mood != b.mood)
    return a.mood < b.mood;
  else
    return a.hair > b.hair;
}
prik mp(int a, int b, int c) {
  prik q;
  q.hair = a;
  q.mood = b;
  q.ind = c;
  return q;
}
prik a[110000], b[110000], c[110000];
int main() {
  bool used[110000] = {0};
  int n, t, d, m, k, ii[110000];
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> t >> d;
    a[i] = mp(t, d, i);
    b[i] = a[i];
    c[i] = a[i];
  }
  sort(b, b + n, comp1);
  sort(c, c + n, comp2);
  for (int i = 0; i < n; i++) {
    ii[c[i].ind] = i;
  }
  int mm = INT_MAX;
  for (int i = 0, cn = 0; cn < k; i++) {
    if (ii[b[i].ind] >= m - k) {
      cn++;
      cout << b[i].ind + 1 << ' ';
      if (ii[b[i].ind] < mm) {
        mm = ii[b[i].ind];
      }
    }
  }
  for (int i = mm - 1; i >= mm - m + k; i--) {
    cout << c[i].ind + 1 << ' ';
  }
}
