시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 64 MB2621076634.197%

## 문제

Alice needs to send a secret password to Bob. The password consists of N​space-separated integers. She decides to use a messenger, Eve, to send the password. To ensure that Eve does not steal the password, Alice uses a method of encoding she invented -- by writing it in a loop.

For example, if the password is “37 20 71 33 97”, Alice writes it down as “20 71 33 97 37”. She notifies Bob beforehand that the starting point for the message is the 5th integer, so he knows to decode the message starting from there. To make the password harder to guess, she may also use a different starting point. For example, Alice can also write the password as “71 33 97 37 20” where the starting point is the 4th integer.

Being an experienced hacker, Eve managed to figure out Alice’s encoding scheme (but not the starting points). Furthermore, Eve was Alice’s messenger twice, hence she has two of Alice’s encoded messages. Eve wishes to know whether it is possible that Alice has sent the same secret password twice.

Your task is work out whether it is possible two of those encoded messages are for the same secret password.

## 입력

Line 1: A single positive integer N​corresponding to the number of integers in the secret password. (N​ ≤ 100,000)

Line 2: N space-separated positive integers ai corresponding to the integers in the first encoded message. (ai ≤ 1,500,000,000)

Line 3: N space-separated positive integers bi​ corresponding to the integers in the second encoded message. (bi ≤ 1,500,000,000)

## 출력

YES or NO indicating whether it is possible that both loops are for the same password.

## 예제 입력 1

5
20 71 33 97 37
71 33 97 37 20


## 예제 출력 1

YES


## 예제 입력 2

5
20 71 33 97 37
71 33 20 97 37


## 예제 출력 2

NO


## 예제 입력 3

6
1 1 2 2 3 3
1 3 3 2 2 1


## 예제 출력 3

NO