import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Map<String, Integer> map = new LinkedHashMap<>();
while (in.hasNext()) {
String str = in.next();
String[] strs = str.split("\\\\");
String file = strs[strs.length - 1];
int line = in.nextInt();
if (file.length() > 16) {
file = file.substring(file.length() - 16);
}
String key = file + " " + line;
int num = 1;
if (map.containsKey(key)) {
map.put(key, map.get(key) + 1);
} else {
map.put(key, num);
}
}
int cnt = 0;
for (String s : map.keySet()) {
cnt++;
if (cnt > map.keySet().size() - 8) {
System.out.println(s + " " + map.get(s));
}
}
}
}