using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication43
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            bool[] t = new bool[n]; 
            for (int i = 0; i < n; i++)
            {
                int x = int.Parse(Console.ReadLine());
                string[] s = Console.ReadLine().Split();
                string[] s2 = Console.ReadLine().Split();
                for (int j = 0; j < x; j++)
                {
                    int m = x-1;
                    int c = Math.Abs(int.Parse((s2[m])));
                    if (int.Parse(s[j])==c)
                    {
                        t[i] = true;
                    }
                    else
                    {
                        t[i] = false;
                        break;
                    }
                    m--;
                }
            }
            for (int i = 0; i < n; i++)
            {
                if (t[i]==true)
                {
                    Console.WriteLine("DA");
                }
                else
	            {
                    Console.WriteLine("NE");
	            }
            }
        }
    }
}