#include <bits/stdc++.h>


using namespace std;

int main(){


    long long int n;
    cin >>n;
    for(long long int i = 0;i<n;i++){
        long long int a;
        cin >>a;
        vector <long long int> v1;
        vector <long long int> v2;
        long long int k;
        long long int k1;
        for(long long int j = 0;j<a;j++){
            long long int b;
            cin>>b;
            if(b!=0){
                k = abs(b);
            }
            v1.push_back(b);

        }
        for(long long int j = 0;j<a;j++){
            long long int c;
            cin>>c;
            if(c!=0){
                k1 = abs(c);
            }
            v2.push_back(c);

        }
        if(k == k1){
            cout<< "DA"<<endl;
        }
        else{
            cout<<"NE"<<endl;
        }



    }


    return 0;
}