import java.lang.*;
import java.util.*;
public class Main {
public static final Scanner scanner = new Scanner(System.in);
public static void testCase(int caseIndex)
{ //각 테스트케이스에 대하여
int num1 = scanner.nextInt();
int num2 = scanner.nextInt();
// 두 숫자의 최대 공약수와 최소 공배수를 계산한다
long gcd = MathUtil.getGCD(num1, num2);
long lcm = MathUtil.getLCM(num1, num2, gcd);
// 정답을 출력한다
System.out.printf("Case #%d:\n", caseIndex);
System.out.printf("%d %d\n", gcd,lcm);
}
public static void main(String[] args) throws Exception {
int caseSize = scanner.nextInt();
for (int caseIndex = 1; caseIndex <= caseSize; caseIndex += 1) {
testCase(caseIndex);
}
}
}
class MathUtil{
static long getGCD(long a, long b)
{
if(b == 0) return a;
else return getGCD(b, a % b);
}
static long getLCM(long a, long b, long gcd)
{
return a * b / gcd;
}
}