import java.util.*;
public class Main
{
static int n,d,k,p,cnt[]=new int [100005];
static pair a[]=new pair[100005];
static boolean b[]=new boolean[100005];
public static void main(String []args)
{
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
d=sc.nextInt();
k=sc.nextInt();
for(int i=0;i<n;++i)
{
int ts=sc.nextInt();
int td=sc.nextInt();
a[p]=new pair();
a[p].ts=ts;
a[p].td=td;
p++;
}
Arrays.sort(a,0,p,new mcomparator());
for(int i=0,j=0;i<n;++i)
{
int id=a[i].td;
cnt[id]++;
while(a[i].ts-a[j].ts>=d)
{
cnt[a[j].td]--;
j++;
}
if(cnt[id]>=k)b[id]=true;
}
for(int i=0;i<=100000;++i)
if(b[i])
{
System.out.println(i);
}
}
static class pair
{
public int ts,td;
}
static class mcomparator implements Comparator<pair>
{
public int compare(pair o1, pair o2) {
return o1.ts-o2.ts;
}
}
}