d = {} for _ in range(int(input())): f = input() d[f] = 1 + d.get(f, 0) c = 0 for f in sorted(d.keys()): if d[f] - 1: print(f, "-", d[f]) c += 1 if not c: print("Однофамильцев нет")