Formally, You Choose Three Integers

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

You are given two arrays aa and bb of the same length nn.

You are allowed to perform zero or more operations on aa of the following kind:

Choose a contiguous subarray of even length and cyclically shift it by an even number of positions. Formally, you choose three integers i,ji, j and kk (0i<j<kn0 \leq i < j < k \leq n, jij - i is even, kik - i is even) and aa becomes equal to a_0:i+a_j:k+a_i:j+a_k:na\_{0:i} + a\_{j:k} + a\_{i:j} + a\_{k:n}, where a_l:ra\_{l:r} denotes a slice with Python indexing. Precisely, it contains elements in the range of indices \[l,r)\[l,r) in 0-indexing and (l,r](l,r] in 1-indexing.

Is it possible to transform aa into bb?

입력

The first line contains a single integer nn (1n31051 \leq n \leq 3 \cdot 10^5), the length of aa and bb.

The second line contains nn integers a_ia\_i (1a_in1 \leq a\_i \leq n), elements of aa.

The third line contains nn integers b_ib\_i (1b_in1 \leq b\_i \leq n), elements of bb.

출력

Print 1 if it is possible to transform ss into tt and 0 otherwise.