#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
//#include <bits\stdc++.h>

using namespace std;

int main()
{   
    long long int n, niz[100000], q, zad[100000], brojac = 0;
    cin >>  n;
    for(long long int i = 1; i <= n; i++){
        cin >> niz[i];
    }
    cin >> q;
    for(long long int i = 1; i <= 2*q; i += 2){
        cin >> zad[i] >> zad[i+1];
    }
    for(long long int i = 1; i < 2*q; i += 2){
        brojac = 0;
        for(long long int k = zad[i]; k < zad[i+1]; k++){
            if(niz[k] > niz[k+1])brojac++;
        }
        if(brojac > 1) cout << "NE" << endl;
        else cout << "DA" << endl;
    }
    
    

    return 0;
}