#include <bits/stdc++.h>
using namespace std;
template <class T, size_t n>
ostream &operator<<(ostream &os, array<T, n> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, multiset<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class T>
ostream &operator<<(ostream &os, set<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class K, class X>
ostream &operator<<(ostream &os, map<K, X> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}
using ii = pair<long long, long long>;
using vb = vector<bool>;
using vi = vector<long long>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vvii = vector<vii>;
struct task {
  long long hair;
  long long hurt;
  long long index;
};
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, p, k;
  cin >> n >> p >> k;
  vector<task> t(n);
  for (long long i = 0; i < n; i++) {
    cin >> t[i].hair >> t[i].hurt;
    t[i].index = i + 1;
  }
  sort(t.begin(), t.end(), [](const task &a, const task &b) {
    return (a.hurt < b.hurt or (a.hurt == b.hurt and a.hair > b.hair));
  });
  set<ii> hairy;
  set<ii> hurty;
  for (long long i = p - k; i < n; i++) {
    hairy.insert({t[i].hair, i});
    if ((long long)hairy.size() > k) {
      hairy.erase(hairy.begin());
    }
  }
  long long LIMIT = 1e18 + 10;
  for (auto &[h, index] : hairy) {
    LIMIT = min(LIMIT, index);
  }
  for (long long i = 0; i < LIMIT; i++) {
    hurty.insert({t[i].hurt, i});
    if ((long long)hurty.size() > p - k) {
      hurty.erase(hurty.begin());
    }
  }
  vi ans;
  for (auto &[h, i] : hairy) ans.push_back(t[i].index);
  for (auto &[h, i] : hurty) ans.push_back(t[i].index);
  for (long long x : ans) cout << x << " ";
  cout << '\n';
}
