import java.util.*;
class Solution {
public int[] solution(String[] id_list, String[] report, int k) {
int answer[]=new int[id_list.length];
HashMap<String, Integer> report_count = new HashMap<String, Integer>();
HashSet<String> report_set = new HashSet<String>(Arrays.asList(report));
for(String r: report_set){
String key=r.split(" ")[1];
report_count.put(key, report_count.getOrDefault(key,0)+1);
}
for(String r:report_set){
String[] id=r.split(" ");
if(report_count.get(id[1])>=k){
int index = Arrays.asList(id_list).indexOf(id[0]);
answer[index]+=1;
}
}
return answer;
}
}