#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef pair<int, int> PII;
const int N = 100010;
int n, d, k;
PII logs[N];
int cnt[N];
bool st[N]; //标志每个帖子是否是热帖
int main()
{
scanf("%d%d%d", &n, &d, &k);
for (int i = 0; i < n; i ++ ) scanf("%d%d", &logs[i].x, &logs[i].y);
sort(logs, logs + n);//对时间排序
for (int i = 0, j = 0; i < n; i ++ )
{
int id = logs[i].y;
cnt[id] ++ ;//计算每个id所获得的点赞数
while (logs[i].x - logs[j].x >= d)//若两个指针之间距离超过d
{
cnt[logs[j].y] -- ;//相当于舍弃掉尾部的记录,在规定距离里,如果超出了,则logs[i].y的点赞数减一,
j ++ ;//缩短两者之间的距离,回到规定距离里
}
if (cnt[id] >= k) st[id] = true;//标志成功了的热帖
}
for (int i = 0; i <= 100000; i ++ )
if (st[i])
printf("%d\n", i);//输出热帖的id
return 0;
}