NOI Contest Archive

Archive / 2020 / December 2020

Super Spell

Easy · National Olympiad in Informatics Sri Lanka - December 2020

Little Ron is struggling in his first year at Hogwarts magic school. Prof. Snape was not happy with his performance. So, he decided to give Ron a small exercise to complete in his mid-year vacation.

Ron has a collection of n spells. He has to select exactly one character from each spell and make a new spell by concatenating each selected character. From the set of possible spells that can be formulated the spell which is lexicographically smallest is called the super spell.

Ron got to know that he can score more if he can come up with the super spells. As Ron is not good at his studies, he needs your assistance. Help Ron with finding the super spell for each collection of spells.

Input Format

The first line of input will be a single integer m, the number of spell collections that Ron will be given.
The next lines will be as follows.

Output Format

Output m lines, a line for each super spell.

Constraints

Limits

Sample Input 0

2
3
asdfsdf
sdfsdfb
sfsdfd
2
xyztxc
pqurstwxe

Sample Output 0

abd
ce