#/usr/bin/python3
import re
import sys
group = {}
regexp = '^(\S+) (\S+) (\S+) \[([^]]+)\] "(\w+) (\S+).*" (\d+) (\S+)'
for line in sys.stdin:
   line = line.rstrip ( )
   match = re.match (regexp, line) 
   if match:
     print (match.group(1)," ",match.group(8))
     ip = match.group(1)
     vol = match.group(8)
     if ip in group:
        group[ip] = group[ip] + vol
     else:
        group[ip] = vol
for key in group.keys():
   print (key, " ", group[key])

