#include <iostream>


using namespace std;

struct poklon
{
	int l;
	int r;
};

int main()
{
	int n;
	cin >> n;
	
	int a[n];
	
	for(int i = 1; i <= n; i++)
		cin >> a[i];

	int q;
	cin >> q;
	
	poklon b[q];
	for(int i = 0; i < q; i++)
		cin >> b[i].l >> b[i].r;
		
	int ind = 0;
		
	for(int i = 0; i < q; i++)
	{
		ind = 0;
		
		
		
		if((b[i].r - b[i].l) <= 2)
			cout << "DA" << endl;
			
			
		else
		{
			for(int j = b[i].r; j > b[i].l; j-=2)
			{
			  if(a[j] < a[j-1] || a[j-2] < a[j-3]) ind++;
			  if(ind > 1) break;
			} 

			
		    if(ind <= 1)
				cout << "DA" << endl;
			
			else
				cout << "NE" << endl;
		} 
	}
	
	return 0;
}