文理学院程序设计在线练习


Moving bricks with superman

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 12   Accepted Submission(s): 2
Problem Description

Xiao Ming is a normal person. One day he got the super power, that he can shuffle the thing which is 1000 times heavier than himself. So he decides to challenge superman in moving bricks. However, superman can fly, so he decides to play with the superman in a more fair way.
There are two stairways between the basement and the ground. Each stairway has n steps. There are some bricks on each step. Every time someone can move the bricks from one step to next high step(unit to the ground), and that person must move at least one brick on the same step.
If one can’t move any bricks anymore, he loses the game. The ground is regarded as the 0th step. So Xiao Ming wonders if he and the superman both takes the best strategy, and Xiao Ming plays first, can he win the game?

Input

There are no more than 100 cases in this problem. Each case contains a number n, which means there are n steps between the basement and the ground.
And there are two lines followed representing the number of the bricks on each step on each stairway. All of the number is below 4294967296.

Output

Print “YES” if Xiao Ming wins, otherwise print “NO”.

Sample Input
2
1 1
1 1
3
2 1 2
1 2 1
Sample Output
NO
NO
Source

2017绍兴市联赛