#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    cin >> t;
    while(t--) {
        ll n,x1=0,y1=0,x2=0,y2=0;
        cin >> n;
        vector<ll>a(n),b(n);
        for(ll i=0;i<n;i++) {
            cin >> a[i];
            if(a[i]<0) x1++;
            else y1++;
        }
        for(ll i=0;i<n;i++) {
            cin >> b[i];
            if(a[i]<0) x2++;
            else y2++;
        }
        bool flag=1;
        for(ll i=0;i<n;i++) {
            if(a[i]==b[i]||a[i]==-b[i]) flag=0;
        }
        if(flag&&(x1==y2||x1==x2)) cout << "DA\n";
        else cout << "NE\n";
    }
    return 0;
}