/** 1.过滤截取路径 2.增加数量

*/

let obj = {}
let str;
while(str = readline()) {
    const [c, n] = str.split(" ");
    const s = c.substr(c.lastIndexOf('\\') + 1).substr(-16)
    obj[`${s} ${n}`] = (obj[`${s} ${n}`] || 0) + 1
}

Object.keys(obj).slice(-8).forEach(el => {
    print(`${el} ${obj[el]}`)
})