CSES - Aalto Competitive Programming 2024 - wk10 - Wed - Fishers
  • Time limit: 1.00 s
  • Memory limit: 512 MB

There are n fishers numbered 1,2,\dots,n scattered around a round lake. Each of the fishers has picked a fixed point on the shoreline and is casting their line to that exact direction. Check if there is a risk of the lines getting tangled up. Tangling may only happen when two lines cross each other.

The fishers and their line casting directions are represented in the array f of 2n integers. If the i-th integer of f is X then it means that position i is occupied by fisher X and if it is -X then this is the point to which the fisher is casting their line. Positions i and i+1 are next to each other and as the lake is round, consider positions 2n and 1 to be next to each other also.

Input

The first line contains a single integer n. The second line contains 2n integers f_1,\,f_2,\dots,\,f_{2n}.

Output

Print "Yes" if the lines might get tangled up and "No" otherwise.

Constraints

  • 1 \leq n \leq 10^5
  • -n \leq f_i \leq n
  • f_i \neq 0
  • f_i \neq f_j if i \neq j

Example 1

Input:

5
-1 -4 5 3 2 -5 1 4 -3 -2

Output:

Yes

Example 2

Input:

5
-2 4 -4 2 3 1 5 -5 -1 -3

Output:

No