After a lot of hard work, Goyal has finally completed his app. But before he launches it, he needs to test it. His friends are helping him on this. Whenever a friend uses the app, his name is recorded in the logs. At the end of the day, Goyal makes a "Hall of Fame" by number of times a person has used his app, and promises to give a treat to the leader.
Things are getting out of control as his friends are trying hard to make it to the top on the hall of fame. The server is barely able to handle this amount of traffic as Goyal has lots of friends testing his app. Hence, he is facing problems preparing the hall of fame. Help him prepare it with your world-renowned programming skills.
Input Format:
The first line contains number of entries in the log. The next line contains space separated entries, each denoting the name of the friend who used his app.
Output Format:
Output the hall of fame as "name number_of_times_used" sorted in decreasing order of number_of_times_used. In case of a tie, order by time.
Constraints:
1 <= Number of entries <= 100