F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Solving Order

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8715    Accepted Submission(s): 4734


Problem Description
Welcome to HDU to take part in the first CCPC girls' competition!



As a pretty special competition, many volunteers are preparing for it with high enthusiasm.
One thing they need to do is blowing the balloons.

Before sitting down and starting the competition, you have just passed by the room where the boys are blowing the balloons. And you have found that the number of balloons of different colors are strictly different.

After thinking about the volunteer boys' sincere facial expressions, you noticed that, the problem with more balloon numbers are sure to be easier to solve.

Now, you have recalled how many balloons are there of each color.
Please output the solving order you need to choose in order to finish the problems from easy to hard.
You should print the colors to represent the problems.
 

Input
The first line is an integer $T$ which indicates the case number.
And as for each case, the first line is an integer $n$, which is the number of problems.
Then there are $n$ lines followed, with a string and an integer in each line, in the $i$-th line, the string means the color of ballon for the $i$-th problem, and the integer means the ballon numbers.

It is guaranteed that:
$T$ is about 100.
$1\leq n\leq 10$.
$1\leq$ string length $\leq 10$.
$1\leq$ bolloon numbers $\leq 83$.(there are 83 teams :p)
For any two problems, their corresponding colors are different.
For any two kinds of balloons, their numbers are different.
 

Output
For each case, you need to output a single line.
There should be $n$ strings in the line representing the solving order you choose.
Please make sure that there is only a blank between every two strings, and there is no extra blank.
 

Sample Input
3 3 red 1 green 2 yellow 3 1 blue 83 2 red 2 white 1
 

Sample Output
yellow green red blue red white
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-24 13:14:36, Gzip enabled