color-code

Our Earth is so beautiful due to the various amazing colours it contains. Now on Earth day we invited Species from Mars (called Martian) Planet to celebrate it with us and to let them know our Earth. 
Martians got so much attracted with the beauty of our Earth and invited people of Earth to visit their Planet Mars.

But there is a problem People of Earth made a condition that Mars should have some of the Colours of Earth so only they will visit.

And this is not the only one problem as the Language spoken on Earth and Mars differs too.
So you have been assigned a task to help the Martians make the Mars as beautiful as Earth so we can visit there.

Your task is, you are given three Integers values of Colours Red, Green and Blue respectively. You are required to convert these values into Mars' language.

Language spoken on Mars is same as Hexadecimal Number Notation but instead of using starting letters of Alphabet they use ending letters.

For better understanding see the Sample Input and Sample Output.

INPUT:

First line contains integer T (number of Test Cases). Next T lines will contains three integers R, G & B values of Red, Green and Blue colour respectively.

OUTPUT :

Produce output for each Test Case in new line in the below depicted format as  Case x: y where x represents Test Case Number and y represents output for Test Case numbered x

CONSTRAINTS

1 ≤ T ≤ 25

0 ≤ R, G, B ≤ 255

Note :- To be Eligible for Prizes you have to register and create your home address maptag.

Click here to create your Maptag

SAMPLE INPUT
2
15 9 120
255 98 174

SAMPLE OUTPUT
Case 1: 0Z 09 78
Case 2: ZZ 62 UY

Explanation

For Case 1: R = 15 when divide by 16 gets remainder 15 which is represented by 'Z'. Note that in Hexadecimal 15 is represented by letter 'F'. 

The same process follows for all values of Case 1 & 2.

Difficulty: MEDIUM

Starter code:

Solutions:
def test(a1,a2):
	ans1=''
	if a1>9:
		if a1==10:
			ans1+='U'
		elif a1==11:
			ans1+='V'
		elif a1==12:
			ans1+='W'
		elif a1==13:
			ans1+='X'
		elif a1==14:
			ans1+='Y'
		else:
			ans1+='Z'
	else:
		ans1+=str(a1)

	if a2>9:
		if a2==10:
			ans1+='U'
		elif a2==11:
			ans1+='V'
		elif a2==12:
			ans1+='W'
		elif a2==13:
			ans1+='X'
		elif a2==14:
			ans1+='Y'
		else:
			ans1+='Z'
	else:
		ans1+=str(a2)
	return ans1
   # print ans1

for __ in range(int(input())):
	
	arr=list(map(int,input().split()))
	
	li=[]
	for i in range(3):
		div=arr[i]/16
	   
		mod=arr[i]%16
	   
		ans=str(div)+str(mod)
	   
		li.append(test(div,mod))
		#print li
	print("Case %d: %s %s %s"%((__+1) ,li[0],li[1],li[2]))
		


for i in range (1 , int(input())+1):
	inputs = [int(x) for x in input().split()];
	for x in range (0 , 3):
		if(inputs[x] <= 15):
			inputs[x] = hex(inputs[x]).replace('0x', '0').replace('a' ,'U').replace('b' , 'V').replace('c' ,'W').replace('d' , 'X').replace('e' ,'Y').replace('f' , 'Z');
		else:
			inputs[x] = hex(inputs[x]).replace('0x', '').replace('a' ,'U').replace('b' , 'V').replace('c' ,'W').replace('d' , 'X').replace('e' ,'Y').replace('f' , 'Z');
	print("Case %s: %s %s %s" %(i , inputs[0] , inputs[1], inputs[2]))


n = int(input())
res = []
transform = {'a':'U', 'b': 'V', 'c': 'W', 'd': 'X', 'e': 'Y', 'f': 'Z'}
temp = 'Case 1: '

for i in range(0, n):
	nums = input()
	nums = nums.split()
	for k in nums:
		t = ''
		t1 = hex(int(k))[2:]
		for j in range(0, len(t1)):
			if t1[j] in transform:
				t += transform[t1[j]]
			else:
				t += t1[j]
		if len(t) < 2:
			t = '0'+t
		temp += t+' '
	res.append(temp)
	temp = 'Case '+str(i+2)+': '
for i in res:
	print(i)


for j in range(int(input())):
	a,b,c=list(map(int,input().split()));
	a=hex(a);	b=hex(b);	c=hex(c);
	a=a[0]+a[2:];	b=b[0]+b[2:];	c=c[0]+c[2:];	
	st,st1,st2='','','';	string=''
	for i in a:
		if( ord(i)>=97 and ord(i)<=122):			st+=chr(ord(i)+20);
		else:	st+=i
	for i in b:
		if( ord(i)>=97 and ord(i)<=122):			st1+=chr(ord(i)+20);
		else:	st1+=i;
	for i in c:
		if( ord(i)>=97 and ord(i)<=122):			st2+=chr(ord(i)+20);
		else:	st2+=i;
	st=st.upper();	st1=st1.upper();	st2=st2.upper();
	string="Case "+str(j+1)+": "+st[-2:]+' '+st1[-2:]+' '+st2[-2:]+' '
	print(string)


def convertToMars(ins):
	global alphs
	if ins < 16:
		res = "0"
		res += alphs[ins%16]
		return res
	else:
		res = ""
		while ins > 15:
			res1 , ins = divmod(ins, 16)            
			res += alphs[res1]
		res += alphs[ins]
		return res




alphs = ['0','1','2','3','4','5','6','7','8','9','U','V','W','X','Y','Z']
indx = 0
for _ in range(eval(input())):
	r, g, b = list(map(int, input().split()))
	x = convertToMars(r)
	y = convertToMars(g)
	z = convertToMars(b)
	indx+=1
	print("Case %s: %s %s %s" % (str(indx), x, y, z)) 


t=eval(input(""))
for j in range(1,t+1,1):
	g=[]
	m=list(map(int,input("").split()))
	for i in range(0,len(m),1):
		if len(hex(m[i]))==3:
			s='0'+hex(m[i]).split('x')[1]
			s=s.replace('a','U')
			s=s.replace('b','V')
			s=s.replace('c','W')
			s=s.replace('d','X')
			s=s.replace('e','Y')
			s=s.replace('f','Z')
			g.append(s)
		else:
			s=hex(m[i]).split('x')[1]
			s=s.replace('a','U')
			s=s.replace('b','V')
			s=s.replace('c','W')
			s=s.replace('d','X')
			s=s.replace('e','Y')
			s=s.replace('f','Z')
			g.append(s)
	print('Case %d%s' % (j,':'),' '.join(map(str,g)))
	


T=int(input())
symbols=['0','1','2','3','4','5','6','7','8','9','U','V','W','X','Y','Z']

for t in range(T):
	n=[int(i) for i in input().split()]
	res=['','','']
	for j in range(3):
		for i in range(2):
			rem=n[j]%16
			n[j]=n[j]//16
			res[j]=symbols[rem]+res[j]
	print(("Case "+str(t+1)+": "+res[0]+" "+res[1]+" "+res[2]))


t=int(input())
ti=0
while ti<t:
	a,b,c=list(map(int,input().strip().split()))
	a=hex(a).split('x')[1]
	b=hex(b).split('x')[1]
	c=hex(c).split('x')[1]
	print("Case "+str((ti+1))+":", end=' ')
	r=""
	i=0
	while i<len(a):
		if a[i]=='f':
			r+="Z"
		elif a[i]=='e':
			r+='Y'
		elif a[i]=='d':
			r+='X'
		elif a[i]=='c':
			r+='W'
		elif a[i]=='b':
			r+='V'
		elif a[i]=='a':
			r+='U'
		else:
			r+=a[i]
		i+=1
	if len(r)==1:
		r='0'+r
	elif len(r)<1:
		r='00'+r
	print(r, end=' ')
	r=""
	i=0
	while i<len(b):
		if b[i]=='f':
			r+="Z"
		elif b[i]=='e':
			r+='Y'
		elif b[i]=='d':
			r+='X'
		elif b[i]=='c':
			r+='W'
		elif b[i]=='b':
			r+='V'
		elif b[i]=='a':
			r+='U'
		else:
			r+=b[i]
		i+=1
	if len(r)==1:
		r='0'+r
	elif len(r)<1:
		r='00'+r
	print(r, end=' ')
	r=""
	i=0
	while i<len(c):
		if c[i]=='f':
			r+="Z"
		elif c[i]=='e':
			r+='Y'
		elif c[i]=='d':
			r+='X'
		elif c[i]=='c':
			r+='W'
		elif c[i]=='b':
			r+='V'
		elif c[i]=='a':
			r+='U'
		else:
			r+=c[i]
		i+=1
	if len(r)==1:
		r='0'+r
	elif len(r)<1:
		r='00'+r
	print(r)
	ti+=1


for i in range(eval(input())):
	l=[int(x) for x in input().split()]
	s=""
	s1=""
	for j in range(0,len(l)):
		if(len(hex(l[j])[2:])==1):
			s+="0"+hex(l[j])[2:]+" "
		else:
			s+=hex(l[j])[2:]+" "
	for h in range(0,len(s)):
		if(s[h]=="a"):
			s1+="U"
		elif(s[h]=="b"):
			s1+="V"
		elif(s[h]=="c"):
			s1+="W"
		elif(s[h]=="d"):
			s1+="X"
		elif(s[h]=="e"):
			s1+="Y"
		elif(s[h]=="f"):
			s1+="Z"
		else:
			s1+=s[h]
	print("Case",str(i+1)+":",s1)