ASCII (American Standard Code for Information Interchange) Characters within the range 33-126 are the most frequently used ASCII Characters that are visible to the naked eye. These characters can be printed in tabular form in column major order in more than one way. Some of which are shown below:
33-126 valued ASCII Characters printed in a 7 x 14 Grid | 33-126 valued ASCII Characters printed in a 9 x 11 Grid |
33-126 valued ASCII Characters printed in a 8 x 12 Grid | 33-126 valued ASCII Characters printed in a 10 x 10 Grid |
So no columns except the last one can have empty cells at the bottom but each column must contain at least one character (Filled from the top).
Now the problem is that somehow you have lost the dimension of the printed grid but you remember two characters that were printed in the same row. Based on this information you will have to find the possible dimension of the original printed grid.
Input
First line of the input file contains a positive integer T (T ≤ 10000) which denotes the number of test cases to follow. Each test case consists of two space separated characters c1 and c2 (33 ≤ c1, c2 ≤ 126 and c1 ≠ c2) as inputs in a single line. Look at the sample input for details.
Output
For each test case, print the case number in a single line first. Then produce one or more lines of output, each of which should contain two integers that denote the dimension of a possible (Row and Column) grid. These two integers should be separated by a single space. If there is more than one solution then they should be printed in the increasing order of the value of row.
Print a blank line after the output of each test case. Look at the output for sample input for details.
Sample
Sample Input | Sample Output |
---|---|
2 A U 1 8 | Case 1: 1 94 2 47 4 24 5 19 10 10 20 5 Case 2: 1 94 7 14 |