#include <bits/stdc++.h>

using namespace std;

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