eolymp
bolt
Try our new interface for solving problems
Problems

Division

Division

\textbf{m }(\textbf{m} ≤ \textbf{100}) candles are placed on a square cake of size \textbf{n}×\textbf{n }(\textbf{n }≤ \textbf{100}). Determine whether a straight cut can divide the cake into two parts of equal size so that all the candles will be on one part. The candles are considered as points. The cut can not pass through the candle. \InputFile The first line contains the number of tests. The first line of each test contains the length \textbf{n} of the square. The second line contains the number of candles \textbf{m} on the cake. The third line - the coordinates of candles, separated by spaces: \textbf{x_1 y_1 x_2 y}_\{2 \}… \textbf{x_m y_m}, \textbf{0 }< \textbf{x_i}, \textbf{y_i} < \textbf{n}, given in a coordinate system with origin at one corner of the square and the axles - sides of the square. All numbers are positive integers. The coordinates of all the candles are different. \OutputFile For each test case print the string containing \textbf{YES}, if such a separation is possible, or \textbf{NO} otherwise.
Time limit 1 second
Memory limit 64 MiB
Input example #1
2
6
4
1 1 2 2 1 2 2 1
20
10
1 1 2 2 1 2 2 1 10 10 3 4 7 2 3 8 2 11 11 3
Output example #1
YES
NO
Source Школа Программиста, Красноярский край, Пятая командная олимпиада, 15 ноября 2009, Задача D