Problem: Surya loves to play with primes. One day, he asked his friend don to print any number in the form of multiple of prime factors. Help don in solving the problem. 

Input
The first line will contain an integer t (1 ≤ t ≤ 10^6) denoting number of test case. 
For each test case, you will be given an integer n (2 ≤ n ≤ 10^6).

Output
Print a string showing prime factors which should look like :
2^e1 * p2^e2 * .........* pk^ek 
where p1, p2, ...., pn are the prime factors and e1, e2, ....., en is the degree of corresponding prime factor.

Note: power of 2 should always be given.
For a prime number , only 2^0 is printed.

SAMPLE INPUT
3
32
100
9085

SAMPLE OUTPUT
2^5
2^2*5^2
2^0*5^1*23^1*79^1

Solution (in PYTHON):

Solution:
def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac
t = int(raw_input())
for _ in range(t):
    l = []
    ans = []
    d = {}
    sd = {}
    d[2] = 0
    n = int(raw_input())
    l = primes(n)
    for i in l:
        if i not in d:
            d[i] = 1
        else:
            d[i] += 1
    if(len(d)==2 and d[2]==0):
        print '2^0'
    else:
        sd = sorted(d.items())
        for k,v in sd:
            ans.append("%d^%d"%(k,v))
        print "*".join(ans)