#include <iostream>

using namespace std;

int main()
{
    int t; cin >> t;
    int rez[t];
    for(int i = 0; i < t; i++)
    {
        int o;int y; o = 0; y = 0;
        int x = 0;
        int n;

        cin >> n;
        int a[n];
        int b[n];
        for(int j = 0; j < n; j++)
        {
            cin >> a[j];
        }
        for(int j = 0; j < n; j++)
        {
            cin >> b[j];
        }

        for(int j = 0; j < n; j++)
        {
            x=0;
            for(int k = 0; k < n; k++)
            {
                if(abs(a[j]) == abs(b[k]))
                {
                    if((j%2 == k%2 && a[j] == -b[j]) || (j%2 != k%2 && a[j] == b[j]))
                        o++;
                }
                else
                    x++;
                if(x == n)
                    y = -1;
            }
        }
        if(o == 0 && y == 0)
            rez[i] = 1;
        else
            rez[i] = 0;
    }
    for(int i = 0; i < t; i++)
    {
        if(rez[i])
            cout << "Da" << endl;
        else
            cout << "Ne" << endl;
    }

    return 0;
}