rajat-the-pandit
Source: hackerearth
Difficulty: EASY

Rajat the Pandit on this New Year wanted to divide his Cuboidal Packaging block into cubes. But he loves uniformity so he asks you to divide it such a way that all the cubes are of same size and volume of individual cube is as large as possible.

Note: He will utilize whole volume i.e volume of cuboid before dividing is same as sum of volume of all the cubes.

Input
The first input line contains an integer T, the number of testcases. Each testcase consist of single line which consist of 3 space separated integers a, b & c representing length, breadth and height of the Cuboidal block.

Output
For each testcase you need to output 2 space separated integers, the length of side of the cube and the number of cubes which could be formed out of this cuboidal packaging block. As the number of cubes which could be made could be a large number so just output the answer modulus 109+7 (1000000007).

Constraints
1 = T = 1000
1 = a,b,c = 109

SAMPLE INPUT
2
2 4 6
1 2 3

SAMPLE OUTPUT
2 6
1 6

Explanation

In the 1st testcase a=2, b=4 & c=6. So length of the side of the cube would be 2 and the number of cubes which would be formed would be 6. In the 2nd testcase a=1, b=2 & c=3. So length of the side of the cube would be 1 and the number of cubes which would be formed would be 6.


from fractions import gcd
for _ in range(int(input())):
	a, b, c = list(map(int, input().split()))
	d = gcd(gcd(gcd(a, b), gcd(a, c)), gcd(b, c))
#	d = min(gcd(a, b), gcd(a, c), gcd(b, c))
	print(d, ((a/d) * (b/d) * (c/d)) % 1000000007)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
from fractions import gcd
from functools import reduce
t=eval(input())
while t>0:
	t-=1
	l=[int(i) for i in input().split()]
	m=reduce(gcd,l)
	x=1
	for i in l:
		x*=(i/m)
	print(m%1000000007,x%1000000007)