N by N chessboard with N queens
Given an chessboard and N
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 N
(1 ≤ N ≤ 100).
The next N
lines contain the coordinates of the queens (1 ≤ ≤ N).
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