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