#include<iostream>
#include<cstring>
#include<algorithm>
#define x first
#define y second
using namespace std;
const int N = 1e5+10;
int n,d,k;
typedef pair<int,int> PII;
PII logs[N];
int cnt[N];
bool st[N];
int main()
{
cin>>n>>d>>k;
for(int i=1;i<=n;i++)
scanf("%d%d",&logs[i].x,&logs[i].y);
sort(logs+1,logs+1+n);
for(int i=1,j=1;i<=n;i++)
{
int id = logs[i].y;
cnt[id] ++;
while(logs[i].x -logs[j].x >= d)
{
cnt[logs[j].y] --;
j++;
}
if(cnt[id] >= k) st[id] = true;
}
for(int i=0;i<N;i++) if(st[i]) printf("%d\n",i);
}