#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n;
    cin >> n;
    vector<long long> brojevi;
    long long br=0;
    vector<long long> freq(n,0);
    long long p;
    cin >> p;
    for(long long i = 1;i<n;i++){
        long long x;
        cin >> x;
        if(p>x){
            br++;
        }
        if(i>0){
            p=x;
        }
        freq[i]+=br;
    }
    long long q;
    cin >> q;
    for(long long i = 0;i<q;i++){
        long long a,b;
        cin >> a >> b;
        if(freq[b-1]-freq[a-1]<=1){
            cout << "DA" << endl;
        }else{
            cout << "NE" << endl;
        }
    }
    return 0;
}