A Seed of a number n is a number x such that multiplication of x with its digits is equal to n. The task is to find all seeds of a given number n. x should not be equal to n. If no seed exists, then print -1.
Input : n = 138 Output : 23 23 is a seed of 138 because 23*2*3 is equal to 138 Input : n = 4977 Output : 79 711 79 is a seed of 4977 because 79 * 7 * 9 = 4977. 711 is also a seed of 4977 because 711 * 1 * 1 * 7 = 4977
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer n.
For each test case in a new line print the space separated values of the seeds in increasing order.
1 <= T <= 300
1 <= n <= 1000
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.