#Lutece0541. Griefsyndrome
Griefsyndrome
Migrated from Lutece 541 Griefsyndrome
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
During the endless transmigration, Madoka with her friends beat the witches time and time again. The abilities of them are different.
If the Magical Girl’s ability is higher than the witch's, they can eliminate the witch. Otherwise they will die just as Mami san did. In order to eliminate all the witches, Magical Girls need to save their power. So the one with lowest ability who could beat the witch would go to eliminate the witch.
Now, they meet a series of witches again. You shoule tell them for each witch who will go to eliminate it.
If they can't beat all the witches at all, just output Game over.
.
You can assume that after each fighting with a single witch, the ability of the Magical Girl is not changed.
Input
The first line of the input contains one integer (), which indicate the number of test cases.
In each test case, the first five lines indicate name and ability for the girls. Then, there will be an integer () which means the number of witches. Next lines, each line indicates name and ability for a single witch.
All the names' length won't exceed , and the ability won't exceed . The ability of these Magical Girl are distinct.
Before each test case there will be a blank line.
Output
For each test case, if Magical Girls can beat all the witches, next lines output one of girls' names. Otherwise just output Game over.
Output a blank line after each case.
Samples
2
Madoka 90
Homura 87
Sayaka 65
Mami 73
Kyouko 80
4
Gertrud 68
Charlotte 80
Elly 79
Gisela 40
Homura 74
Madoka 95
Kyouko 68
Sayaka 40
Mami 77
3
Charlotte 30
Patricia 70
Walpurgis 99
Mami
Homura
Kyouko
Sayaka
Game over.
Resources
luozijian