import java.util.Scanner;
import java.util.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
//按插入顺序存储
LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
while(in.hasNext()){
String str = in.next();
String num = in.next();
//d:\ASDAD\asdSFD 3
int index = str.lastIndexOf("\\");
String fileName = str.substring(index + 1);
if (fileName.length() > 16) {
fileName = fileName.substring(fileName.length() - 16, fileName.length());
}
//key为文件名:行数 如weixin:653
String key = fileName + ":" + num;
map.compute(key, (k, v)-> v == null ? 1 : v + 1);
}
in.close();
int i = 0;
int start = 0;
if (map.size() > 8) {
start = map.size() - 8;
}
for (Map.Entry<String, Integer> e : map.entrySet()) {
if (i < start) {
i++;
continue;
}
String[] split = e.getKey().split(":");
System.out.println(split[0] + " " + split[1] + " " + e.getValue());
}
}
}