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.

Examples:

```
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
```

**Input:**

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.

**Output:**

For each test case in a new line print the space separated values of the seeds in increasing order.

**Constraints:**

1<=T<=300

1<=n<=1000

**Example:
Input:**

2

4977

138

79 711

23

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.

ShubhamJain18 | 205 |

makeitdonesolo | 140 |

lost_found | 124 |

maggiiiii | 118 |

SahatPrasad1 | 108 |

Bishnu Dev Panda | 777 |

okayboss | 551 |

ShubhamJain18 | 516 |

yk12 | 514 |

makeitdonesolo | 480 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.