N by N chessboard with N queens
Given an chessboard and queens with their coordinates, you are asked if there are any two queens that attack each other.
Input
The first line of the input contains a single integer
.The next
lines contain the
coordinates of the queens . Output
The program should print
Yes
in case there are queens attacking each other and No
otherwise. Examples
Input | Output |
4
1 2
2 4
3 1
4 3 | No |
4
1 1
2 3
3 4
4 2 | Yes |
Explanation
Example 1
Example 2
Β
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB