#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n;
    cin >> n;
    int a[n], b[n];
    int cnt1=0, cnt2=0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        cnt1+=a[i]>0;
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
        cnt2+=b[i]>0;
    }
    if (n == 1) {
        cout << (abs(a[0]) == abs(b[0]) ? "DA" : "NE" ) << '\n';
        return;
    }
    cout << (cnt1%2 == cnt2%2 ? "DA" : "NE") << '\n';
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}