CPC 1 Problem 2 - Chika's Arithmetic Square

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Chika has a 3 \times 3 grid of integers. She wishes to verify if this grid is arithmetic.

A grid is arithmetic if each row and each column forms an arithmetic sequence.

Constraints

1 \le T \le 10^4

-10^6 \le a_{ij} \le 10^6

Input Specification

The first line contains a single positive integer, T, representing the number of test cases. T test cases follow.

Each test case consists of three space-separated integers, the a_{ij} values. The first line contains the integers in the three columns of the first row in order. The second line contains the integers in the three columns of the second row in order. The third line contains the integers in the three columns of the third row in order.

Output Specification

Output T lines. On line i, output YES if the ith square is arithmetic. Otherwise, output NO.

Sample Input

2
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
1 1 2

Sample Output

YES
NO

Comments

There are no comments at the moment.