#include<iostream>

using namespace std;

 int main(void){
	
	int n;
	cin>>n;
	int q[n];
	for(int i=1;i<=n;i++){
		cin>>q[i];
	}
	int m;
	cin>>m;
	

	for(int j=1; j<=m; j++){
		int p;
		int k;
		int y=0;
		y=0;
		cin>>p;
		cin>>k;
		for(int l=p;l<k-1;l++){
			int h=l;
			int g=k;
			while(h<g){
				if(q[h]>q[g]){
				y++;
			}
			g--;
			}
		
			
		}
		if(y>2){
			cout<<"NE"<< endl;
		}
		else cout<<"DA"<< endl;
	}
	
		
	
	return 0;
}