Problem B
Stacking Cups
Languages
en
ja
For instance, for a red cup with a radius of $5$ units, your module will receive either “red 5” or “10 red” message.
Given a list of messages from the core routine, each describing a different cup, can you put the cups in order of the smallest to the largest?
Input
The first line of the input file contains an integer $N$, the number of cups ($1 \leq N \leq 20$). Next $N$ lines will contain two tokens each, either as “color radius” or “diameter color”. The radius of a cup $R$ will be a positive integer less than $1000$. The color of a cup $C$ will be a non-empty string of lower case English letters of length at most $20$. All cups will be different in both size and color.
Output
Output colors of cups, one color per line, in order of increasing radius.
Sample Input 1 | Sample Output 1 |
---|---|
3 red 10 10 blue green 7 |
blue green red |