Problem F
Röðun
Languages
en
is
One of the popular tasks in computer science is the problem of sorting. Given a list of sortable items, for example numbers or strings, with the goal being to order them in either increasing or decreasing order. In this problem the task is to sort a list of contestants’ names in increasing order by number of problems solved. Pairs of names will be given, saying which of the contestants solved more problems. No two contestants solved the same number of problems. Find the order of the contestants or say that there isn’t enough information to figure it out.
Input
The first line of the input contains integers
Output
The names of the contestants in increasing order by their number of solved problems, separated by spaces, if the order can be deduced. If there is not enough information given, instead print veit ekki.
Scoring
Group |
Points |
Constraints |
1 |
20 |
|
2 |
30 |
|
3 |
50 |
|
Sample Input 1 | Sample Output 1 |
---|---|
3 3 Arnar Benni Unnar Arnar > Benni Benni < Unnar Unnar < Arnar |
Benni Unnar Arnar |
Sample Input 2 | Sample Output 2 |
---|---|
6 5 Andrea Arna Freyja Hanna Sigga Unnur Freyja > Sigga Hanna < Sigga Arna > Unnur Andrea > Arna Andrea < Hanna |
Unnur Arna Andrea Hanna Sigga Freyja |
Sample Input 3 | Sample Output 3 |
---|---|
8 12 Bernhard Ernhardb Rnhardbe Nhardber Hardbern Ardbernh Rdbernha Dbernhar Bernhard > Ernhardb Ernhardb > Rnhardbe Rnhardbe > Nhardber Rnhardbe > Hardbern Rnhardbe > Ardbernh Rnhardbe > Rdbernha Rnhardbe > Dbernhar Nhardber > Ardbernh Hardbern > Ardbernh Ardbernh > Rdbernha Ardbernh > Dbernhar Dbernhar < Rdbernha |
veit ekki |