It's so blue
题号:NC237639
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

PaiGuDragon took part in a round robin style group-stage football game.

There are 6 teams in the group competition, with the marks of 1,2,3,4,5,6 respectively, PaiGuDragon is in team 1

There will be one match between each two teams, and 15 matches will be held.

For each game, the team with more goals will be the winner.

The winner will get 3 points, the loser will get 0 points.

If two teams get the same number of goals, each team get 1 points

After the group match, the team with higher points will be ranked higher. If the points are the same, the team with more difference goals (goals minus lost goals) will be ranked higher. If the difference goals are the same, the team with more goals will be ranked higher. Otherwise, the team will be ranked higher by drawing lots.

The top three will advance to the knockout stage.

There will be 5 rounds. The schedule is as follows

Round 1: 1 vs 2, 3 vs 4, 5 vs 6

Round 2: 1 vs 3, 2 vs 5, 4 vs 6

Round 3: 1 vs 4, 2 vs 6, 3 vs 5

Round 4: 1 vs 5, 2 vs 4, 3 vs 6

Round 5: 1 vs 6, 2 vs 3, 4 vs 5


The results of the first three rounds have been given. 

PaiGuDragon is so disappointed with it's performance, but we should never give up, right?

Can PaiGuDragon creates miracles in the remaining two rounds?

Will PaiGuDragon has the possibility to qualify for the knockout stage?

输入描述:

The input consists of multiple test cases. The first line contains a single integer  - the number of test cases. Description of the test cases follows.

The first line of each test case contains 6 integers - the number of goals of team 1,2,3,4,5,6 in order, representing the results of the first round, each number is a non-negtive integer between 0 to 10

The second line of each test case contains 6 integers - the number of goals of team 1,3,2,5,4,6 in order, representing the results of the second round, each number is a non-negtive integer between 0 to 10

The third line of each test case contains 6 integers - the number of goals of team 1,4,2,6,3,5 in order,representing the results of the third round, each number is a non-negtive integer between 0 to 10

ps:The number of goals in the last two rouns can be any non-negative integer

输出描述:

For each test case, output "YES" if the PaiGuDragon has the possibility to qualify for the group stage, otherwise "NO" (without quotation marks).

示例1

输入

复制
2
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
1 3 4 0 4 2
2 4 4 0 3 1
3 4 3 3 2 2

输出

复制
YES
NO

说明

In the test case 1, PaiGuDragon will qualify for the knockout stage if it beats team5 with 100:0 and beats team6 with 100:0

In the test case 2, following is the results of the first three round

Round 1:

team 1 vs team 2: 1: 3
team 3 vs team 4: 4: 0
team 5 vs team 6: 4: 2

Round 2:

team 1 vs team 3: 2: 4
team 2 vs team 5: 4: 0
team 4 vs team 6: 3: 1

Round 3:

team 1 vs team 4: 3: 4
team 2 vs team 6: 3: 3
team 3 vs team 5: 2: 2


here is the current rank list

team 2 score = 7, difference goals = 6
team 3 score = 7, difference goals = 6
team 4 score = 6, difference goals = -1
team 5 score = 4, difference goals = -2
team 6 score = 1, difference goals = -4
team 1 score = 0, difference goals = -5 

if PaiGuDragon win the next two games, it will get 6 score.

However, let's consider the game team 4 vs team 5, one team will get at least 7 points whatever the result, so PaiGuDragon has no chance :(