Big Orange Cat(大橘) loves doing puzzles. He has n types of puzzles in total, and each puzzle i can be represented by a string Ai composed of all visible characters from the ASCII code.
Unfortunately, he messed up the puzzles, what a baganono... Now for each puzzle i, he has found some puzzle pieces, represented by a string Bi. Your task is to find a way to tell Big Orange Cat from which positions in Bi he should take out puzzle pieces and rearrange them to form Ai.
However, there might be many possible ways, and since Big Orange Cat is very lazy, please output the lexicographically smallest method.
Important: The method for comparing the lexicographic order of two strings is as follows: Starting from the first position (leftmost), find the first character that differs. The string with the smaller character at that position is considered lexicographically smaller. For example, "abc" < "abd" because the first differing letter 'c' < 'd'.
The first line of input contains an integer n. n represents the number of puzzle-instruction manual pairs.
The following n lines each contain two strings, Ai and Bi, separated by a space. They represent the i-th puzzle and instruction manual, respectively.
Tips: ASCII Codes 33 ~ 126 are: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Output n lines, each line should be in one of the following two formats according to the situation:
"baganono"
(without quotation marks)Please remember to print "\n" at the end, and dont print space (" ") at the end of every line.
hint 1: The key to finding the lexicographically smallest solution lies in Big Orange Cat's personality: laziness. Therefore, the secret is to take the smallest possible numbers.
hint 2: Try to recall how you determined whether it was possible to form the required string in homework 4.