You are given a \(3\times 3\) grid. Each number in the grid is represented by $$C_{ij}$$ where \((i,j)\) denotes the square at the \(i^{th}\) row from the top and \(j^{th}\) column from the left.
Bob gets confused. According to him, there are six integers \(a_1, a_2, a_3, b_1, b_2, b_3\) whose values are fixed and the number written in the square \((i,j)\) is equal to \(a_i + b_j\). You are required to determine whether Bob is correct or not.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- Next three lines contain three space-separated integers $$C_{i1}, C_{i2}$$, and $$C_{i3}$$ denoting the \(i^{th}\) row of grid $$C$$.
Output format
For each test case, print YES if Bob's statement is correct. Otherwise, print NO in a new line.
Constraints
For first testcase, the set of $$6$$ integers $$(a_1,a_2,a_3,b_1,b_2,b_3)$$ = $$(2,3,2,1,2,5)$$. Therfore, Lucky's statement is correct.
For second testcase, there are no possible set of $$6$$ integers. Therefore, Lucky's statement must be incorrect.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor