#include <iostream>

using namespace std;

struct secondV{
    int value = 0;
    int pos = 0;
    bool negative = false;
    bool apeared = false;
    bool shouldHave = false;
};

int main()
{
    int t = 0;
    cin >> t;
    bool canS[t];
    
    
    for (int i = 0; i < t; i++){
        canS[i] = true;
    }
    
    for (int i = 0; i < t; i++){
        canS[i] = true;
        int n;
        cin >> n;
        int niz1[n];
        int niz2[n];
        secondV offsets[n];
        
        for (int s = 0; s < n; s++){
            cin >> niz1[s];
        }
        
        for (int s = 0; s < n; s++){
            
            offsets[s].pos = 0;
            offsets[s].apeared = false;
            offsets[s].shouldHave = false;
            offsets[s].negative = false;
            
            cin >> niz2[s];
            offsets[s].value = niz2[s];
            if (niz2[s] < 0){
                offsets[s].negative = true;
            }
        }
        
        for (int s = 0; s < n; s++){
            
            for (int j = 0; j <= n; j++){
                if (offsets[j].value == niz2[s]){
                    offsets[j].apeared = true;
                }
                if (abs(offsets[j].value) == abs(niz1[s])){
                    offsets[j].shouldHave = true;
                }
                
                if (offsets[j].shouldHave && !offsets[j].apeared){
                    offsets[j].pos -= 1;
                }
                else if (!offsets[j].shouldHave && offsets[j].apeared){
                    offsets[j].pos += 1;
                }
            }
        }
        
        for (int s = 0; s < n; s++){
            if (offsets[s].negative && abs(offsets[s].pos) % 2 == 0){
                canS[i] = false;
            }
        }
    }
    
    for (int i = 0; i < t; i++){
        if (canS[i]){
            cout << "DA" << endl;
        }
        else{
            cout << "NE" << endl;
        }
    }
}