#include <bits/stdc++.h>
using namespace std;

int main(){
    int T, N;
    cin >> T;

    for( int i = 1; i <= T; i++ ) {
        cin >> N;

        int A[N];
        for( int j = 1; j <= N; j++ ) {
            cin >> A[j];

            A[N] = A[j];
        }

        int B[N];
        for( int k = 1; k <= N; k++ ) {
            cin >> B[k];

            B[N] = B[k];
        }

        if( -(A[N]) == B[N] ) {
            cout << "NE" << endl;
        } else {
            cout << "DA" << endl;
        }

    }
    return 0;
}