[Ques] Palindrome Pain solution codechef
You are given two integersand . You need to construct two different strings and consisting of only the characters and , such that the following conditions are satisfied:
- Both palindromes. and are
- Both and should contain exactly occurrences of and occurrences of .
If there are multiple possible answers, you may print any of them. If it is not possible to construct two distinct strings satisfying the conditions, printinstead.
- The first line of input will contain a single integer , denoting the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input containing two space-separated integers .
For each test case:
- If it is not possible to construct two distinct strings satisfying the conditions, print
- Otherwise, print two lines — the first should contain the string and the second should contain
- If there are multiple possible answers, you may print any of them.
Sample Input 1
2 2 4 3 3
Sample Output 1
abbbba babbab -1
Test case: The three palindromes containing -s and -s are and . Printing any two of these is a valid answer.
Test case: There are no palindromes containing each of and .