#include <bits/stdc++.h>
# define endl            '\n'
# define clr(x,a)        memset(x,a,sizeof(x))
# define vi              vector<int>
# define all(a)          a.begin(), a.end()
# define deb(x)          cout<<#x<<"=="<<x<<endl;
# define pb              push_back
# define sc              scanf
# define pr              printf
# define tc              int t; cin>>t; while(t--)
# define rev(s)          reverse(s.begin(),s.end())
# define linija          cout<<"___________\n";
using namespace std;
typedef long long ll;
const int mxN=200005, mxM=200005, LOG=25, inf=1e8;
const int mod=998244353;
template<typename T> T nzd(T a, T b){if(b==0) return a;else return nzd(b, a%b);}
template<typename T> T nzs(T a, T b){return(a*(b/nzd(a,b)));}
template<typename T> T stepenuj(T e, T n){T x=1,p=e;while(n){if(n&1)x=(x*p)%mod;p=(p*p)%mod;n>>=1;}return x;}
template<typename T> inline T na2(T x){return x*x;}
int n, q, a[mxN], ps[mxN], l, r;
int ps1[mxN], ps2[mxN], tst2;

void solve(){
   for(int i = 1; i <= n; i++){
      ps1[i] = ps1[i-1];
      ps2[i] = ps2[i-1];

      if(a[i] == 1) ps1[i]++;
      else ps2[i]++;
   }
   int duz, dva, jed;

   tc{
      sc("%d %d", &l, &r);
      duz = r-l+1;
      dva = ps2[r]-ps2[l-1];
      jed = ps1[r]-ps1[l-1];

      if(dva == duz || dva == 0){
         cout << "DA\n";
      }
      else if(dva == (duz-1) || dva == 1){
         cout << "DA\n";
      }
      else{
         if(ps1[l+jed-1] - ps1[l-1] == jed){
            cout << "DA\n";
         }
         else if(ps1[l+jed] - ps1[l-1] == jed){
            cout << "DA\n";
         }
         else cout << "NE\n";
      }
   }
}
int main(){
//   freopen("in.txt", "r", stdin);
   cin >> n;
   tst2=1;
   for(int i = 1; i <= n; i++){
      sc("%d", &a[i]);
      ps[i] = ps[i-1];
      if(a[i] >= a[i-1]) ps[i]++;
      if(a[i] > 2) tst2=0;
   }
   if(tst2){
      solve();
      return 0;
   }
   cin >> q;
   for(int i = 1; i <= q; i++){
      sc("%d %d", &l, &r);
      if(ps[r] - ps[l] >= (r-l-1)) cout << "DA\n";
      else cout << "NE\n";
   }


	return 0;
}