import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
/**
*
7 10 2
0 1
0 10
10 10
10 1
9 1
100 3
100 3
*
*/
public class Main{
public static void main(String[] args) {
Map<Integer,Integer> map = new HashMap<Integer,Integer>();//统计次数
Map<Integer,Integer> map2 = new HashMap<Integer,Integer>();//记录初始时间
Map<Integer,Integer> map3 = new HashMap<Integer,Integer>();//将符合次数要求的放在map3里
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int dtime = in.nextInt();
int k = in.nextInt();
int[][] a = new int[n][2];
for(int i = 0;i<n;i++) {
a[i][0] = in.nextInt();
a[i][1] = in.nextInt();
}
for (int i = 0; i < n; i++) {
if(!map.containsKey(a[i][1])) {
map.put(a[i][1], 1);
map2.put(a[i][1], a[i][0]);
}
else {
if(a[i][0]<map2.get(a[i][1])+dtime) {
map.put(a[i][1], map.get(a[i][1])+1);
}
}
}
for(int i = 0;i<n;i++) {
if(map.get(a[i][1])>=k) {
map3.put(a[i][1], 1);
}
}
Iterator<Integer> it = map3.keySet().iterator();
while(it.hasNext()) {
int i = it.next();
System.out.println(i);
}
}
}