Problem

12 /19


Unique login

Problem

Surnames and names of students are given as input to the program. It is known that the total number of students does not exceed 100. The first line contains the number of students who took part in the competition, N. This is followed by N lines with the following format: 
<Lastname> <Name>, 
Where <LastName> – a string of no more than 20 characters;
<Name> – a string of no more than 15 characters.
At the same time, <Surname> and <Name> separated by a single space.

Input string examples:    
Maria Ivanova
Sergey Petrov 

It is required to write a program that generates and prints a unique login for each student according to the following rule: if the surname occurs for the first time, then the – this is the given surname, if the surname occurs a second time, then the login – this is a surname that ends with the number 2, etc.
For example, for an input sequence 
Ivanova Maria 
Sergey Petrov 
Boitsova Ekaterina 
Petrov Ivan 
Ivanova Natasha
the following logins will be generated: 
Ivanova 
Petrov
Boytsova
Petrov2 
Ivanova2