#include<bits/stdc++.h>

using namespace std;

int main(){
    int n; cin >> n;

    vector<int> niz(n);
    for(int i = 0; i < n; i++) cin >> niz[i];

    int m; cin >> m;
    int l, r;
    for(int k = 0; k < m; k++){
        cin >> l >> r;
        int prev = niz[l-1], brojac = 0;
        for(int i = l; i < r; i++){
            if(niz[i] < prev) brojac++;
            if(brojac > 1){
                cout << "NE\n";
                break;
            }
            prev = niz[i];
        }
        cout << "DA\n";
    }

    return 0;
}