using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

public class Test
{
    public static void Main()
    {
        string cin;
        List<string> list = new List<string>();
        Dictionary<string, int> dic = new Dictionary<string, int>();
        while((cin = Console.ReadLine()) != null)
        {
            if(cin != "")
            {
                list.Add(cin);
            }
        }
        for(int i = 0;i < list.Count;i++)
        {
            string[] array = list[i].Split(' ');
            string line = array[1];
            string[] fileArray = array[0].Split('\\');
            string name = fileArray[fileArray.Length - 1];
            if(name.Length > 16){
                name = name.Substring(name.Length - 16,16);
            }
            string key = name+"_"+line;
            if(!dic.ContainsKey(key))
            {
                dic.Add(key, 1);
            }
            else
            {
                dic[key] += 1;
            }
        }
        List<string> ls= new List<string>();
        foreach(var item in dic)
        {
            ls.Add(item.Key.Replace("_", " ") + " " + item.Value);
        }
        if(ls.Count > 8)
        {
            int dif = ls.Count - 8;
            for(int i = 0;i < dif;i++)
            {
                ls.RemoveAt(0);
            }
        }
        foreach(var item in ls)
            Console.WriteLine(item);
    }
}