“My sister’s best friend - Anusha is like a sister. Her family and my family are like family. We give our qurbani together, yes that close……..”
Ok wait! Ringing any bell?
Yes these lines were taken from famous writer Raba Khan’s book বান্ধobi. This book is so good that after reading two or three pages of this book I got a brain full of knowledge and a mind full of enthusiasm.
In the last few days problem setter committee called me several times and told me to give a problem for contest but you know I am not as much good as like them. My brain hardly can generate any problem idea. But thanks to this book it was there to save me. Now finally I have a problem idea.
Read the following line carefully from the same book of Raba Khan–
“I honestly love her and consider her as my 13th favorite human being alive.”
Every time this line gives me goosebumps. Look how she (the great Raba Khan) is ordering all the human being she like. Do you ever tried this? I tried and failed clumsily. Do you have enough time to help me?
In this problem you will be given name of n friends (বান্ধobi) of mine and a point for each of them which defines how much I like them. Let’s call this point RBpoint. You have to sort all my friend’s name in decreasing order of RBpoint.
Note: It is guaranteed that all friends name and all RBpoints will be unique.
First line of input will contain the value of n and 2<=n<=26. Next n lines will contain one upper case english alphabet which is friend’s name and an integer number which is RBpoint for that friend. All RBpoints will be between 1 and 100.
print n friend name sorted by their RBpoint. See sample output section for clear idea.
3 A 1 B 3 C 2
B C A