By Aline Regina de Oliveira, IFSULDEMINAS Brazil
After Tustin bought his new dice he and his friends, Nike, Jucas and Uill played a lot of the RPG T&T (Tatus and Taturanas).
Everyone knows, that Tustin always uses his lucky dice, a classic six-sided dice that has all the numbers from 1 to 6, and the sum of two opposing faces is always 7.
But Tustin's lucky die was so used That the numbers on some of the faces are gone, so he wants to fill it in so that the dice becomes classical again.
The first line of input contains a number C that indicates the number of test cases. Each test case consists consists of three lines, which represent the planning of the die, as in the figure above. Each face will be indicated by a number N or by '*' representing an erased face.
(1 <= N <= 6 )
Your program should show how many different ways the die can be filled.
Input Sample | Output Sample |
1 1 2 6 5 * |
2 |