ILVASCIS - Atito’s family
Atito has a very large family with two special features, they live for a really long time and there are no equally aged sons.
Atito “the father” is back from Luxor, he brought presents to every member of his family. He asked his little son Youssef A.K.A Joe to sort his family from the oldest to the youngest in order to give them the presents in an appropriate way, since Joe is small “only seven years old” he asked your help to sort the family.
Input
Your program will be tested on one or more test cases. The first line of input will be a single integer T, the number of test cases (1<=T<=100). Each test case starts with an integer N (1<=N<=100) denotes the number of the members in the family, then it is followed by N lines, each line consists of a family member's name “without spaces” and an integer D denoting his age (1<=D<=150).
Output
For each test case, print "Case_#i:" where 'i' is the number of the test case and '_' is a white space, followed by N line each line contains the name of the family members from the oldest to the youngest and there is a blank line between each two consecutive cases.
Example
Input:
1
7
Ahmed 20
Youssef 7
Sara 24
Reham 11
Rana 12
Mohammed 28
Ayman 19 Output:
Case #1:
Mohammed
Sara
Ahmed
Ayman
Rana
Reham
Youssef
Added by: | Mohamed Ali |
Date: | 2014-01-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | acmASCIS Level 1 Contest 2014 |