The russian intelligence agency KGB make an encryption technique to send their passwords. Originally the password is of 3 characters. After encryption the password is converted into 3 numbers A-B-C.

Now, Sherlock wants to decrypt the password encryption technique of KGB. Sherlock knows that every number  has only 2 possible values which are following:

POSSIBLE VALUES OF "A":   K, X

POSSIBLE VALUES OF "B":   G, Y

POSSIBLE VALUES OF "C":   B, Z

Help Sherlock to detect the encryption technique of the KGB and tell him the original password.
[See problem explanation for further clarifiaction]

INPUT:

The first line consist number of test cases T followed by T lines, each line consist of 3 space separated integers A, B, C.

OUTPUT

Print the correct message in format of C-C-C

Constraints:

1 ≤ T ≤ 50000

1 ≤ A, B, C ≤ 1000000000

SAMPLE INPUT
2
27 25 4
25 26 16

SAMPLE OUTPUT
K-G-B
X-Y-B

Explanation

For test case 1, the password sent is 27-25-4, then 27 can be either 'K' or 'X', similar case for 25 & 4. After applying the encryption 27 is converted into K, 25 is converted into G and 4 is converted into B.
T = int(raw_input())
for ti in xrange(T):
	a,b,c = map(int,raw_input().split())
	if a%3:
		s1 = 'X'
	else:
		while a%3==0:
			a /= 3
		if a==1:
			s1 = 'K'
		else:
			s1 = 'X'
	if b%5:
		s2 = 'Y'
	else:
		while b%5==0:
			b /= 5
		if b==1:
			s2 = 'G'
		else:
			s2 = 'Y'
	if c%2:
		s3 = 'Z'
	else:
		while c%2==0:
			c /= 2
		if c==1:
			s3 = 'B'
		else:
			s3 = 'Z'
	print s1+'-'+s2+'-'+s3