#NSQUARE2. NSquare Sum ( Medium )
NSquare Sum ( Medium )
Given Q pairs of integers Ni, Ai (1 <= Ai, Q <= 105, 4 <= N <= 100), find Ni numbers whose square sums is equal to Ai. If there're more than one solution, print the one lexicographically smallest. If there's no solution, print "Impossible".
Q = 1 Ni = 4 A1 = 16 { 42 + 02 + 02 + 02 = 16}
Input
There's an integer Q (1 <= Q <= 105) in the first line; it stands for the number of queries. The next Q lines describe each query with two integers Ni, Ai (1 <= Ai <= 105, 4 <= Ni <= 100). Ni is the number of integers that you need to find whose sum of squares is equal to Ai.
Output
You have to print Q lines, each one with Ni numbers such that the sum of squares is equal to Ai. If there's no solution, you've to print "Impossible".
Example
Input: 1 4 16</p>Output: 0 0 0 4
Input: 1 4 15 Output: 1 1 2 3