Canadian Computing Competition: 2001 Stage 2, Day 1, Problem 3
Given a positive integer , a partition is a sequence of positive integers in decreasing order whose sum is
.
For example,
,
and
are all partitions of
.
Given two distinct partitions,
and
, we will say that
if, for the smallest positive integer
such that
, we have
.
This ordering lets us put all the partitions of a given integer in lexicographical order, where each partition in the ordering is greater than all the partitions before it.
For example, if , the partitions in lexicographical order are
(1,1,1,1,1)
(2,1,1,1)
(2,2,1)
(3,1,1)
(3,2)
(4,1)
(5)
Given
and a positive integer
, you are to find the
partition in the list of partitions of
sorted in lexicographical order.
Input Specification
The input will consist of a line with , the number of test cases, followed by
lines, each of the form
, where
and
are positive integers.
Output Specification
For each test case, your program should output the partition in the list of partitions of
, or, if
is greater than the number of partitions of
, output
Too big
.
Sample Input
3
1 1
5 4
5 8
Sample Output
(1)
(3,1,1)
Too big
Comments