#include <iostream>
using namespace std;

int nizA[30000];
int nizB[30000];


int main()
{
	int n;
	cin >> n;

	string ispis = "";

	for (int i = 0; i < n; i++)
	{
		int n1;
		cin >> n1;
		for (int j = 0; j < n1; j++)
		{
			cin >> nizA[j];
			cin >> nizB[j];
		}

		//pomocni ispis
		/*
		for (int j1 = 0; j1 < n1; j1++)
		{

			cout << '\n';
			cout << "ISPIS" << '\n';
			cout << nizA[j1] << '\n';
			cout << nizB[j1] << '\n';
			cout << "----------" << '\n';
		}
		*/

		// !!PROVERA!!
		bool isti = true;
		for (int j1 = 0; i < n1; i++)
		{

			int t1 = nizA[j1];
			int t2 = nizB[j1];

			for (int k1 = 0; k1 < sizeof(nizA); k1++)
			{
				int t1 = nizB[j1];
				int t2 = (-1) * (nizB[j1]);

			

				for (int l2 = 0; l2 < n1; l2++)
				{
					if (nizA[l2] != nizB[l2])
					{
						isti = false;
						ispis = "NE";
					}

					else
					{
						ispis = "DA";
					}
				}
			}
		}
	}


	cout << ispis;
	return 0;
}