#include <bits/stdc++.h>
using namespace std;
#define ff(i,a,n) for(int i = a;i<n;++i)
int a[200005];
bool slucaj = true;
void solve(){
	bool ans = true;
	int l, r;
	cin>>l>>r;
	l--;
	ff(i,l,r){
		
	}
	
	
	if(ans){
		cout<<"DA";
	}else{
		cout<<"NE";
	}
}
void solve1(){
	int l,r;cin>>l>>r;
	l--;
	int b2 = 0;
	int posljed = -1;
	ff(i,l,r){
		if(a[i] == 1)posljed = i;
	}
	if(posljed == -1){
		cout<<"DA";return;
	}
	ff(i,l,posljed){
		if(a[i] == 2)b2++;
	}
	if(b2>1){
		cout<<"NE";
	}else{
		cout<<"DA";
	}
}
int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
	int n;cin>>n;
	ff(i,0,n){
	cin>>a[i];
	if(a[i]!=1 and a[i]!=2)slucaj = false;
    }
    if(slucaj){
	    int t1;cin>>t1;
		while(t1--){
			solve1();
			cout<<endl;
		}
	}else{
		int t;cin>>t;
		while(t--){
			solve();
			cout<<endl;
		}
    }
	return 0;
}