All Submissions


Your task is to find the minimal positive integer number P so that the product of digits of P is exactly equal to S.

INPUT
The first line of input contains the number of test cases T.
Next T lines conatains the integer S.

OUTPUT
For each test case print the integer P in separate line.Print -1 in separate line if no such integer exist.

CONSTRAINT

0 < T <= 100
1 < S <= 10^9


SAMPLE INPUT

1
10


SAMPLE OUTPUT

25


Problem Setter : Akshay Kumar


Languages: AWK,Bash,Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Python3,Ruby,Text

Time Limit: 0.5 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0