import gzip x = input() i = gzip.open(x, "rt") o = [] v = [] w = [] for l in i: if l.find('KW') == 0: if l.find("{") != -1: q=[] for el in l: if el != '{': q.append(el) else: break q = ''.join(q[5:]) if q.find('}') != -1: q = q.split() q = ''.join(q[1:]) q = q.strip() o.append(q) k = list(set(o)) for n in range(10): m = max(k, key=o.count) print(m + ' ' + str(o.count(m)) ) k.remove(m) i.close()