#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=0,n,i=0,j=0;cin >> t;
    while(t--){
        cin >> n;
        int nega=0, negb=0,broja0=0,brojb0=0,aa=0,bb=0;
        vector<int>a(n);
        vector<int>b(n);
        for(int i2=0;i2<n;i2++){
        cin >> a[i2];
        if(a[i2]<0)nega++;
        else if(a[i2]==0)broja0++;
        else if(a[i2]!=0)aa=a[i2];
        }
        for(int i2=0;i2<n;i2++){
                cin >> b[i2];
        if(b[i2]<0)negb++;
        else if(b[i2]==0)brojb0++;
        else if(b[i2]!=0)bb=b[i2];
        }

        if(broja0 + 2 == n && brojb0+2 == n && aa*(-1)==bb ){
            cout << "DA" << "\n";
            continue;
        }
        cout << "NE" << "\n";
        continue;
    }
    return 0;
}