All submissions for this problem are available.
The Network Treasure Hunt (NTH) is an online treasure hunt. There are hundreds of participants, decrypting messages and taking the help of clues to solve riddles. Participants can go to the next level only after solving the question on their current level.
The NTH team had logs of participants who solved a level and moved to the next level, ordered by increasing time of submission from the start of the contest.
The NTH Team decided to pick winners for every level. The first person who reached a level was the winner of that level.
Given the chronological ordering of correct answers, find the winners of each level.
First line contains an integer N, representing the number of entries in the logs.
N lines follow.
Each line contains a string, representing the username of a player who has moved one level up.
Note: The list is sorted by the time at which the users submitted a right answer.
Print the username of winners of each level, in increasing order of level number.
Each line should contain an integer representing the level followed by a string representing the username of the winner of that level.
The level number and username should be separated by a space
1 ≤ N ≤ 10^5
1 ≤ Length of username of participant ≤ 50
Input: 6 Ankit Akshay Ankit Tarun Akshay Akshay Output: 1 Ankit 2 Ankit 3 Akshay
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
Fetching successful submissions