Kaity is an administrator for the Big Mattress Tournament, where folks compete to see who can make the biggest mattress.
To ensure every person has an even playing field when assembling mattresses, they will be given the same materials to assemble their mattresses.
Specifically, each participant will be given tiles, tiles, and L
tiles, which are tiles with the top-right square removed.
Determine if there is some positive integer such that it is possible to assemble a mattress with the given tiles. You must use all of the tiles, you may not rotate or reflect any of the tiles, and the mattress must be exactly .
Constraints
In tests worth 14 marks, .
Input Specification
The first line contains a single integer .
lines follow, each containing three integers, , , and .
Output Specification
Output lines. On the th line, output YES
if it is possible to make a mattress. Output NO
otherwise.
Sample Input
4
2 0 0
0 2 0
1 0 1
0 1 0
Sample Output
YES
YES
YES
NO
Comments