URI Online Judge | 2600

Tustin and His New Die

By Aline Regina de Oliveira, IFSULDEMINAS BR Brazil

Timelimit: 1

Tustin, Nike, Jucas and Uill will play a famous RPG game, the T & T (Tatus and Taturanas). Like any good RPG game, the dice is an extremely important part.

T & T is played with six-sided dice. Before they started the game, Tustin went to a store to buy a lucky die, because his old one was devoured by the Temogorgon.

Tustin is very selective, and he want to choose a classic dice. A classic dice is a six-sided dice that has all the numbers from 1 to 6, and the sum of two opposite faces is always 7.

That is, if on one side we have the number 1 we would automatically have the number 6 on the other side.

An example of a classical data is given in the figure below. Your task is to check if the die that Tustin bought is really a classic.

Input

The first line of input contains a number N that indicates the number of test cases. Each test case consists of six integers Di (0 <= Di <= 105) representing the value of each face of the die. The numbers will be given in three lines, which represent the planning of the data, as in the figure above.

Output

You should display "SIM" (Yes) if Tustin has purchased a classic dice, and "NAO" (No) otherwise.

Input Sample Output Sample

1
3
1 2 6 5
4

SIM