#include #include #include #include #include #include #include #include using namespace std; typedef pair P; vector G[100005]; int rd[100005]; bool vis[100005]; int main() { int n,m,k; while(scanf("%d%d%d",&n,&m,&k)!=EOF) { for(int i=1;i<=n;i++) G[i].clear(); memset(rd,0,sizeof(rd)); memset(vis,0,sizeof(vis)); while(m--) { int l,r; scanf("%d%d",&l,&r); G[l].push_back(r); rd[r]++; } priority_queue q; for(int i=1;i<=n;i++) { if(rd[i]<=k) { q.push(i); } } bool flag=0; while(!q.empty()) { int p=q.top(); q.pop(); if(vis[p]) continue; if(rd[p]>k) continue; k-=rd[p]; if(flag==0) flag=1; else printf(" "); printf("%d",p); vis[p]=1; int s=G[p].size(); for(int i=0;i