1. 
/**
* FWP: Ausgewaehlte Probleme aus dem ACM (SS10)
*
* Method: Math: Primes
* Problem: 10879 - CodeRefactoring
* Accepted: 2.264
* @author Evgeni Pavlidis
*
*/
import java.io.*;
import java.util.*;

class Main {


public static final int MAX = (int)Math.sqrt(10000000);
public static final boolean[] isPrime = new boolean[MAX+1];
public static final int prime[] = new int[MAX];
public static int maxPrime = 0;
private static int a,b,c,d;

private static void sievePrimes()
{
for(int i = 2; i <= MAX; i++)
isPrime[i] = true;
// sieve the multiples of 2
for(int i = 4; i <= MAX; i+=2)
isPrime[i] = false;

prime[maxPrime++] = 2;

// sieve other numbers
int squareRoot = (int)Math.sqrt(MAX);
for(int i = 3; i <= MAX; i+=2)
if(isPrime[i])
{
prime[maxPrime++] = i;
for(int j = i+i; j <= MAX; j += i)
isPrime[j] = false;
}

/** /
for(int i = 1; i < maxPrime; i++)
System.out.println(prime[i]);
/**/

}

private static void calc(int n)
{
int i = 0;
for( ; i < maxPrime; i++)
if(n % prime[i] == 0)
{
a = prime[i];
b = n / a;
break;
}

for( ; i < maxPrime; i++)
if(n % prime[i] == 0)
{
c = prime[i];

if( prime[i] == a)
if(n % (c*prime[i]) == 0)
c *= prime[i];
else
continue;


d = n / c;
break;
}
}

public static void main(String...args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int cases, k ;

sievePrimes();

cases = Integer.parseInt(reader.readLine());
for(int caseNumber = 1; caseNumber <= cases; caseNumber++)
{
k = Integer.parseInt(reader.readLine());
calc(k);

System.out.printf("Case #%d: %d = %d * %d = %d * %d\n",
caseNumber, k, a, b, c, d);

}
}
}