#include <bits/stdc++.h>
using namespace std;
int n,q,x,y,br;
long long niz[100005],niz1[100005];
int main (){
  scanf("%d", &n);
  for(int i=1;i<=n;i++){
    scanf("%d", &niz[i]);
  }
  scanf("%d", &q);
  while(q--){
      int br=0;
    scanf("%d", &x);
    scanf("%d", &y);
    int j=1;
    for(int i=x;i<=y;i++){
      niz1[j]=niz[i];
      j++;
    }

    int vel=y-x+1;
    if(vel==1){
      cout<<"DA"<<endl;
    continue;
    }
    sort(niz1+1,niz1+vel+1);
   /* for(int i=1;i<=vel;i++){
      cout<<niz1[i]<<" ";
    }
    cout<<endl;*/
    j=1;
    for(int i=x;i<=y;i++){
      if(niz1[j]==niz[i]){
        j++;

      }
      else {br++;
      j++;
      }
    }
  //  cout<<br<<endl;
    if(br>2){
      cout<<"NE"<<endl;
    }
    else cout<<"DA"<<endl;

  }
return 0;
}