import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
List<String> lst = new ArrayList<>();
while (sc.hasNext()) {
lst.add(sc.nextLine());
}
Map<String, Integer> map = new LinkedHashMap<>();
for (String s : lst) {
String[] a = s.split("\\\\");
String str1 = a[a.length-1];
String[] a2 = str1.split(" ");
String s1 = a2[0];
String s2 = s1.length() > 16 ? s1.substring(s1.length() - 16, s1.length()) : s1;
String key = s2 + " " + a2[1];
if (!map.containsKey(key)) {
map.put(key, 0);
}
map.replace(key, map.get(key), map.get(key) + 1);
}
int num = map.size();
int begin = num > 8 ? num - 8 : 0;
int count = 0;
for (Map.Entry<String, Integer> entry : map.entrySet()) {
if (begin <= count) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
count++;
}
}
}