#NIKKEI20192QUALC. Swaps

Swaps

Score : 600600 points

Problem Statement

Given are two integer sequences of NN elements each: A1,...,ANA_1,...,A_N and B1,...,BNB_1,...,B_N. Determine if it is possible to do the following operation at most N2N-2 times (possibly zero) so that, for every integer ii from 11 to NN, AiBiA_i \leq B_i holds:

  • Choose two distinct integers xx and yy between 11 and NN (inclusive), and swap the values of AxA_x and AyA_y.

Constraints

  • 2N1052 \leq N \leq 10^5
  • 1Ai,Bi1091 \leq A_i,B_i \leq 10^9

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 ...... ANA_N

B1B_1 B2B_2 ...... BNB_N

Output

If the objective is achievable, print Yes; if it is not, print No.

3
1 3 2
1 2 3
Yes

We should swap the values of A2A_2 and A3A_3.

3
1 2 3
2 2 2
No
6
3 1 2 6 3 4
2 2 8 3 4 3
Yes