lines = [] ret = dict() while True: try: filename, lineno = input().split() except EOFError: break k = filename.split('\\')[-1][-16:] + " " + lineno if k not in lines: lines.insert(0, k) ret[k] = ret.get(k, 0) + 1 count = 0 files = [] for k in lines: if k not in files: count += 1 files.insert(0, k) if count >= 8: break for k in files: print(k, ret[k])