#include <bits/stdc++.h>
using namespace std;
int main(){
    int counter1 = 0; int counter2 = 0;
    int u;
    cin >> u;
    vector<string> o;
    int sum = 0;
    int n,a,b;
    vector<int> c;
    vector<int> v;
    for(int y = 0; y < u; y++){
        cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        v.push_back(a);
    }
    for(int j = 0; j < n; j++){
        cin >> b;
        c.push_back(b);
    }
    for(int k = 0; k < n; k++){
        c[k] *= -1;
    }
    for(int z = 0; z < n; z++){
        if(v[z] == 0){
            counter1++;
        }
        if(c[z] == 0){
            counter2++;
        }
        else{
            break;
        }
    }
        if(abs(counter1 - counter2) % 2 != 0){
            o.push_back("DA");
        }
        else{
            o.push_back("NE");
        }
    counter1 = 0;
    counter2 = 0;
    v.clear();
    c.clear();
    }
    for(int x = 0; x < o.size(); x++){
        cout << o[x] << endl;
    }
}