## Algorithm

Problem Name: 2 AD-HOC - beecrowd | 2600

# Tustin and His New Die

By Aline Regina de Oliveira, IFSULDEMINAS 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

## Code Examples

### #1 Code Example with C Programming

```Code - C Programming```

``````
#include <stdio.h>
#include <stdbool.h>

bool verificaNum(short vet[]);

int main (void)
{

unsigned short casos, i, j, contador;

scanf("%hu", &casos);

while (casos--)
{
short cmp[] = { 1, 2, 3, 4, 5, 6 };

for (i = 0; i  <  6; i++)

// Se o dado de Tustin atender a todas as exigências
// Ele é um dado clássico;
printf("SIM\n");
else
printf("NAO\n");

}
}

bool verificaNum(short vet[])
{

unsigned short j, i;
short cmp[] = { 1, 2, 3, 4, 5, 6 };

for (i = 0; i  <  6; i++)
{

// Verifica se todos os números e 1 a 6 existem no dado de Tustin;
// Todos os numeros precisam aparecer apenas uma vez no dado;
for (j = 0; j  <  6; j++)
{

if (cmp[i] == vet[j])

return false;
}

return false;
}

return true;

}``````
Copy The Code &

Input

cmd
1 3 1 2 6 5 4

Output

cmd
SIM