In the game of "Spindie", players take turns spinning a spinner and rolling a die.
On each turn, they spin the spinner three times and roll the die between each pair of spins (i.e. the sequence on a single turn is: Spin
, Roll
, Spin
, Roll
, Spin
). Each spin of the spinner lands on some integer and each roll of the die results in an integer from
Here are some example turns of Spindie:
Spin | Roll | Spin | Roll | Spin | Score |
---|---|---|---|---|---|
The input will contain
The first line of each test case will consist of an integer
The next line contains the
The next line will contain five target integers
For each test case, your program should output a single line consisting of T
. If it is not possible, output an F
.
Note that the sample data below contains only
Sample Input
5
23 74 7 64 47
128605 205 2162 2709 71346
3
26 5 11
407 962 455 21 902
4
23 75 89 24
933 484 13248 102 44640
9
23 61 77 83 12 92 1 7 65
72900 144 5704 145 6370
7
87 20 94 99 14 26 87
241956 177 749331 221 4066
Sample Output
FFTFF
TTFTF
FFTFF
FTTTF
TFTFF
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
read this task slowly....