#include <bits/stdc++.h>
using namespace std;
char rez[1000];
long long unsigned k=0;
void proveri(long long unsigned a[],long long unsigned b[], long long unsigned n) {
	long long unsigned i=0,j=0;
	for(i=0;i<n;i++) {
		if(a[i] == 0) j++;
		else if(a[i]*-1==b[i]) j++;
	}
	if(j==n) {
		rez[k++] = 'A';
	}
	else rez[k++] = 'E';	
}
main() {
	long long unsigned i,j,t,n;
	cin>>t;
	for(i=0;i<t;i++) {
		cin>>n;
		long long unsigned a[n],b[n];
		for(j=0;j<n;j++) cin>>a[j];
		for(j=0;j<n;j++) cin>>b[j];
		reverse(a,a+n);
		proveri(a,b,n);
	}
	for(i=0;i<k;i++) {
		if(rez[i]== 'E') cout<< "NE"<<"\n";
		else cout<< "DA"<<"\n";
	}
}