#ARC155C. [ARC155C] Even Sum Triplet

[ARC155C] Even Sum Triplet

Score : 700700 points

Problem Statement

You are given integer sequences of length NN: A=(A1,A2,,AN)A=(A_1, A_2, \dots, A_N) and B=(B1,B2,,BN)B=(B_1, B_2, \dots, B_N).

You may perform the following operation any number of times:

  • Choose an integer i (1iN2)i\ (1 \leq i \leq N-2) such that Ai+Ai+1+Ai+2A_i+A_{i+1}+A_{i+2} is even. Then, rearrange AiA_i, Ai+1A_{i+1}, Ai+2A_{i+2} as you like.

Determine whether it is possible to make AA equal BB.

Constraints

  • 3N2×1053 \leq N \leq 2 \times 10^5
  • 1Ai,Bi2×1051 \leq A_i, B_i \leq 2 \times 10^5
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

B1B_1 B2B_2 \dots BNB_N

Output

If it is possible to make AA equal BB, print Yes; otherwise, print No.

5
1 2 3 4 5
3 1 2 4 5
Yes

A1+A2+A3A_1+A_2+A_3 is 1+2+3=61+2+3=6, which is even, so you can choose i=1i=1.

If you choose i=1i=1 and rearrange A1,A2,A3A_1, A_2, A_3 into A3,A1,A2A_3, A_1, A_2, then AA becomes (3,1,2,4,5)(3, 1, 2, 4, 5).

Now AA equals BB, so you should print Yes.

5
1 2 4 6 5
5 1 4 2 6
No
9
2 10 4 3 6 2 6 8 5
2 4 10 3 8 6 6 2 5
Yes