#include <iostream>

using namespace std;

int main()
{
    int t;
    cin >> t;

    while(t>0)
    {
        long long int n,aa=0,ba=0;
        cin >> n;
        long long int a[n],b[n];
        for(long long int i =0;i<n;i++)
            {cin >> a[i];
                if(a[i]!=0)
                {
                    aa=a[i];
                    ba=i;
                }
            }


        for(long long int i =0;i<n;i++)
            {
                cin >> b[i];
                if(b[i]!=0)
                    {
                        if(n>2 && abs(aa)== abs(b[i])||aa==b[i] && ba==i|| aa==b[i]*(-1)&& ba!=i)
                        cout << "DA" << endl;
                        else
                        cout << "NE" << endl;
                    }
            }



        t--;
    }



    return 0;
}