#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for(int i = (b), _a = (a); i >= _a; i--)
#define pb push_back
#define ll long long
#define MASK(i) (1LL << (i))
const int MAXN = (int)2e5 + 5;
ll t, n, a[MAXN], b[MAXN], pointer;
void solve(){
FOR(i, 1, n - 1){
a[i + 1] += (a[i] / 2);
a[i] %= 2;
b[i + 1] += (b[i] / 2);
b[i] %= 2;
}
FORD(i, n, 1){
if(b[i] > a[i]){
cout << "NO\n";
return;
}
else if(b[i] < a[i]){
cout << "YES\n";
return;
}
}
cout << "YES\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> t;
while(t--){
cin >> n;
FOR(i, 1, n) cin >> a[i];
FOR(i, 1, n) cin >> b[i];
solve();
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIEZPUihpLCBhLCBiKSBmb3IoaW50IGkgPSAoYSksIF9iID0gKGIpOyBpIDw9IF9iOyBpKyspCiNkZWZpbmUgRk9SRChpLCBiLCBhKSBmb3IoaW50IGkgPSAoYiksIF9hID0gKGEpOyBpID49IF9hOyBpLS0pCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgTUFTSyhpKSAoMUxMIDw8IChpKSkKCmNvbnN0IGludCBNQVhOID0gKGludCkyZTUgKyA1OwoKbGwgdCwgbiwgYVtNQVhOXSwgYltNQVhOXSwgcG9pbnRlcjsKCnZvaWQgc29sdmUoKXsKCUZPUihpLCAxLCBuIC0gMSl7CgkJYVtpICsgMV0gKz0gKGFbaV0gLyAyKTsKCQlhW2ldICU9IDI7CgkJYltpICsgMV0gKz0gKGJbaV0gLyAyKTsKCQliW2ldICU9IDI7Cgl9CglGT1JEKGksIG4sIDEpewoJCWlmKGJbaV0gPiBhW2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