Ramen Packs
시간 제한1초메모리 제한2048 MB
각 n에 대해 서로 다른 a^2 꼴과 2b^2 꼴의 합으로 n을 나타낼 수 있는지 판정하고, 가능하면 사용한 팩을 출력한다.
문제
Thomas wants to buy cups of ramen from Liza. She has two brands that he likes: brand A and brand B. Each brand sells packs of ramen in varying sizes. For each integer , there is a brand A pack of size that contains cups of ramen, and a brand B pack of size that contains cups of ramen. Liza has exactly one pack of each type left in stock. Your task is to determine how Thomas can purchase exactly cups of ramen from Liza, or state that such a thing is not possible.
Note that you do not need to minimize the number of packs.
입력
The first line of the input contains a single integer () --- the number of test cases. The description of the test cases follows.
Each test case consists of a single line containing one integer (), the number of ramen cups that Thomas wants from Liza.
출력
For each test case, output a single line.
If it is not possible for Thomas to buy cups of ramen from Liza, simply print .
Otherwise, print a positive integer , followed by a list of pack types. A \it{pack type} is a letter (either A or B) indicating the brand of the ramen pack followed by a positive integer indicating its size. The sum of the number of cups over all packs should be , and no pack type may appear more than once.
힌트
In the first test case, Thomas buys just the pack from Liza for a total of cups.
In the second test case, Thomas can buy the and packs from Liza for a total of cups.
In the third test case, Thomas can buy the and packs from Liza for a total of cups.
In the fourth test case, Thomas can buy the , , , and packs from Liza for a total of cups.