Monk and Conversion Game
Tag(s):

## Easy-Medium

Problem
Editorial
Analytics

Monk was having a great time in the Digital World, and was surprised to see a new game called, "Conversion Game". In this game, two arrays of $N$ integers $A_{1}, A_{2}...A_{N}$ and $B_{1},B_{2}...B_{N}$ are playing against each other and Array $A$ wants to convert itself in Array $B$.

Array $A$ can do two types of operations on itslef:
1 Take two adjacent elements Ai and Ai+1 , increase Ai by 1 and decrease Ai+1 by 1.
2 Take two adjacent elements Ai and Ai+1 , decrease Ai by 1 and increase Ai+1 by 1.

Monk being an awesome coder, wants to know whether Array $A$ can convert itself into Array $B$, by using any number of such operations. You have to print "YES" (without quotes), if Array $A$ can convert itself into array $B$, else print "NO" (without quotes).

INPUT:
First line of input will consists of integer $T$ denoting total number of test cases. Each test case will begin with integer $N$. Next line will consists of $N$ integers $A_{1}, A_{2}...A_{N}$. Next line will consists of $N$ integers $B_{1},B_{2}...B_{N}$.

OUTPUT:
Print "YES" (without quotes), if Array $A$ can convert itself into array $B$ by using any number of operations, else print "NO" (without quotes).

CONSTRAINTS:
1 ≤ T ≤ 10
1 ≤ N ≤ 1000
1 ≤ Ai, Bi ≤ 106

SAMPLE INPUT
2
5
1 2 1 3 2
1 1 1 2 4
5
1 1 10 1 1
1 2 2 2 4
SAMPLE OUTPUT
YES
NO

Explanation

In the first test case, you can arrive at the second sequence using operations on first sequence.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Scala 2.11.8, Swift, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

CodeMonk (Checkpoint - II)

OTHER PROBLEMS OF THIS CHALLENGE
• Basic Programming > Implementation
• Basic Programming > Implementation
• Algorithms > Searching
• Algorithms > Graphs
• Data Structures > Disjoint Data Structures