|All-time Popular Problems|
|Delete Middle of Linked List|
|Intersection of Two Linked Lists|
|Egg Dropping Puzzle|
|Consecutive 1's not allowed|
|Element with left side smaller and right side greater|
|Merge two sorted linked lists|
|Minimum element in a sorted and rotated array|
|Root to leaf path sum|
|Minimum number of jumps|
Given a number n, find the smallest number that has same set of digits as n and is greater than n. If x is the greatest possible number with its set of digits, then print “not possible”.
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is n,n is the number.
Print the greater number than n with same set of digits and if not possible then print "not possible" without double quote.
1 ≤ T ≤ 100
1 ≤ n ≤ 100000