#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t; cin >> t;
while (t--){
    ll n; cin >> n;
    ll a[n], b[n];
    ll poza;
    ll pozb;
    for( ll i = 0; i < n; i++ ){
        cin >> a[i];
        if ( a[i] != 0 ){
            poza = i;
        }
    }
    for ( ll j = 0; j < n; j++ ){
        cin >> b[j];
        if ( b[j] != 0 ){
            pozb = j;
        }
    }
    ll s = 0;
        for ( int i = 0; i < n; i++ ){
            if ( a[i]*b[i] == -1 ){
                s++;
            }
        }
        if (s%2 == 0){
            cout << "DA" << endl;
        }
        else{
            cout << "NE" << endl;
        }
}
return 0;
}