#include<bits/stdc++.h>
using namespace std;
int t; long long n; int a[30005], b[30005], br;
int main(){
    scanf("%d", &t);
    while(t--){
        scanf("%d", &n);
        for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
        for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
        for(int i = 1; i <= n; i++){
            if(a[i] == b[i] * -1) br = 0;
            else br = 1;
        }
        if(br == 1) cout<<"DA"<<endl;
        else if(br == 0) cout<<"NE"<<endl;
    }
    return 0;
}