#CCBCHBAHAI0000009. Hai mảng có cùng bảng tần suất trên miền nhỏ? (Equal Frequency Tables on a Small Domain)

Hai mảng có cùng bảng tần suất trên miền nhỏ? (Equal Frequency Tables on a Small Domain)

Equal Frequency Tables on a Small Domain

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given two integer arrays A=(a1,…,an)A=(a_1,\ldots,a_n) and B=(b1,…,bn)B=(b_1,\ldots,b_n) whose values lie in [0,1000][0,1000]. For each value vv, define its frequencies fA(v)f_A(v) and fB(v)f_B(v). Determine whether fA(v)=fB(v)f_A(v)=f_B(v) for every vv.

Input

Line 1 contains nn. Line 2 contains a1,…,ana_1,\ldots,a_n. Line 3 contains b1,…,bnb_1,\ldots,b_n.

Output

Print YES if the two frequency tables are equal, otherwise NO.

Subtasks

Subtask 1 (20 points): 1≤n≤501\le n\le 50; 0≤ai,bi≤1000\le a_i,b_i\le 100.

Subtask 2 (30 points): 1≤n≤50001\le n\le 5000; 0≤ai,bi≤5000\le a_i,b_i\le 500.

Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000; 0≤ai,bi≤10000\le a_i,b_i\le 1000.

Example

Input

4
1 2 2 3
2 3 2 1

Output

YES

Explanation

The values follow directly from the definitions and illustrate the valid index range of the array scan.