BETA

Difficulty Level: Easy

Submissions: 2635 Accuracy:

35.86%

Possible words from Phone digits
         


Given a keypad as shown in diagram, and a n digit number, list all words which are possible by pressing these numbers.

Input:

The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is N,N is the number of digits.
The second line of each test case contains D[i], N number of digits. 

Output:

Print all possible words from phone digits with single space.

Constraints:

1 ≤ T ≤ 10
1 ≤ N ≤ 5
2 ≤ D[i] ≤ 9

Example:

Input
1
3
2 3 4

Output
adg adh adi aeg aeh aei afg afh afi bdg bdh bdi beg beh bei bfg bfh bfi cdg cdh cdi ceg ceh cei cfg cfh cfi

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Rajat Jha

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.