#P11028. [2016杭电多校]Teacher Bo
[2016杭电多校]Teacher Bo
Teacher Bo
Problem Description
Teacher BoBo is a geography teacher in the school.One day in his class,he marked points in the map,the -th point is at .He wonders,whether there is a tetrad such that the manhattan distance between A and B is equal to the manhattan distance between C and D. If there exists such tetrad,print "YES",else print "NO".
Input
First line, an integer . There are test cases. In each test case,the first line contains two intergers, N, M, means the number of points and the range of the coordinates.. Next N lines, the -th line shows the coordinate of the -th point..
Output
lines, each line is "YES" or "NO".
Sample Input
2
3 10
1 1
2 2
3 3
4 10
8 8
2 3
3 3
4 4
Sample Output
YES
NO
Author
绍兴一中
Source
2016 Multi-University Training Contest 3