/// Author: NemanjaSo2005
/// Date: 26th February 2023
/// Contest: Serbian high school regional contest
/// Anyone can use any part of this code for any purpose after the contest.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,prefiks[200005],p2[200005],p1[200005],niz[200005],primeniz[100005];
vector<int> primes;
ll min(ll a,int b){
   if(a<b)
      return a;
   return b;
}
ll min(int a,ll b){
   if(a<b)
      return a;
   return b;
}
ll max(ll a,int b){
   if(a>b)
      return a;
   return b;
}
ll max(int a,ll b){
   if(a>b)
      return a;
   return b;
}
void getprimes(int n){
   for(int i=1;i<=n;i++)
      primeniz[i]=i;
   for(int i=4;i<=n;i+=2)
      primeniz[i]=2;
   primes.push_back(2);
   for(int i=3;i<=n;i+=2){
      if(primeniz[i]!=i)
         continue;
      for(int j=i*i;j<=n;j+=i)
         primeniz[j]=min(primeniz[j],i);
      primes.push_back(i);
   }
   return;
}
void solve(){
   bool tc4=true;
   cin>>N;
   for(int i=1;i<=N;i++){
      cin>>niz[i];
      if(niz[i]>2)
         tc4=false;
   }
   if(tc4){
      p1[0]=p2[0]=0;
      for(int i=1;i<=N;i++){
         p1[i]=p1[i-1];
         p2[i]=p2[i-1];
         if(niz[i]==1)
            p1[i]++;
         else
            p2[i]++;
      }
      int Q,b1,b2,l,r;
      cin>>Q;
      while(Q--){
         //cout<<endl;
         cin>>l>>r;
         if(r-l+1<=2){
            cout<<"DA\n";
            continue;
         }
         b1=p1[r]-p1[l-1];
         b2=p2[r]-p2[l-1];
         if(b1<=1 or b2<=1){
            cout<<"DA\n";
            continue;
         }
         if(p2[r]-p2[r-b2-1]==b2){
            cout<<"DA\n";
            continue;
         }
         if(p1[l+b1-1]-p1[l-1]==b1){
            cout<<"DA\n";
            continue;
         }
         cout<<"NE\n";
      }
      return;
   }
   prefiks[0]=prefiks[1]=0;
   for(int i=2;i<=N;i++){
      prefiks[i]=prefiks[i-1];
      if(niz[i]<niz[i-1])
         prefiks[i]++;
   }
   ll Q,l,r;
   cin>>Q;
   while(Q--){
      cin>>l>>r;
      if(prefiks[r]-prefiks[l]<=1)
         cout<<"DA\n";
      else
         cout<<"NE\n";
   }
   return;
}
void reset(){}
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   int T=1;
  // cin>>T;
   while(T--){
      solve();
      reset();
   }
   return 0;
}
/*
5
2 1 2 2 1
1
1 5

5
2 1 1 2 1
1
1 5
*/