Scacchiera N×N con N regine

Data una scacchiera e N regine con le rispettive coordinate, si richiede di verificare se esistono due regine che possano attaccarsi a vicenda.

Input

La prima riga dell’input contiene un singolo intero N (1 ≤ N ≤ 100).

Le successive N righe contengono le coordinate delle regine (1 ≤ ≤ N).

Output

Il programma deve stampare Yes se esistono due regine che si attaccano a vicenda, altrimenti No.

Examples

Input

Output

4
1 2
2 4
3 1
4 3

No

4
1 1
2 3
3 4
4 2

Yes

Explanation

Screen Shot 2022-11-01 at 11.01.56 AM.png

Example 1

Screen Shot 2022-11-01 at 11.02.47 AM.png

Example 2

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue