Problem: Solve The Mystery

Input:
First line contains T - number of test cases.
Following T lines each contains a string of characters in the range [a-z] only  

Output:
Print a numeric string for each test case.  

Constraints:
1 ≤ T ≤ 100
1 ≤ Length of String ≤ 100  

SAMPLE INPUT
10
key
to
control
nine
tails
is
in
your
hand
phone

SAMPLE OUTPUT
539
86
2668765
6463
82457
47
46
9687
4263
74663

Solution (in PYTHON):

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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import sys
n=int(raw_input())

while n!=0:
	s=str(raw_input())
	l=len(s)
	for i in range(0,l):
		if(s[i] == 'a' or s[i] == 'A' or s[i] == 'B' or s[i] == 'b' or s[i] == 'C' or s[i] == 'c'):
			sys.stdout.write('2'),
		elif(s[i] == 'd' or s[i] == 'D' or s[i] == 'E' or s[i] == 'e' or s[i] == 'F' or s[i] == 'f'):
			sys.stdout.write('3'),
		elif s[i] == 'G' or s[i] == 'g' or s[i] == 'H' or s[i] == 'h' or s[i] == 'I' or s[i] == 'i':
			sys.stdout.write('4'),
		elif s[i] ==  'J' or s[i] ==  'j' or s[i] ==  'K' or s[i] ==  'k' or s[i] ==  'L' or s[i] ==  'l':
			sys.stdout.write('5'),
		elif s[i] ==  'M' or s[i] ==  'm' or s[i] ==  'N' or s[i] ==  'n' or s[i] ==  'O' or s[i] ==  'o':
			sys.stdout.write('6'),
		elif s[i] ==  'P' or s[i] ==  'p' or s[i] ==  'Q' or s[i] ==  'q' or s[i] ==  'R' or s[i] ==  'r' or s[i] ==  'S' or s[i] ==  's':
			sys.stdout.write('7'),
		elif s[i] ==  'T' or s[i] ==  't' or s[i] ==  'U' or s[i] ==  'u' or s[i] ==  'V' or s[i] ==  'v':
			sys.stdout.write('8'),
		else:
			sys.stdout.write('9'),
	print ""		
	n=n-1