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

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