import re
f=open('new2.txt','r')
g=open('new2.txt','r').read()
count={}
for word in f:
	if word in count:
		count[word]+=1
	else:
		count[word]=1
for w in sorted(count, key=count.get, reverse=True):
	print count[w],w
