#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> glavni(n);
    for(int i = 0; i < n; i++) cin >> glavni[i];
    int q; cin >> q;
    int x, y;
    for(int i = 0; i < q; i++){
        cin >> x >> y;
        if(x == y){
            cout << "DA\n";
            continue;
        }
        int prev = glavni[x - 1];
        int b = 0;
        for(int j = x; j < y; j++){
            if(prev > glavni[j]) b++;
                if(b == 2){
                cout << "NE\n";
                break;
            }
            prev = glavni[j];
            if(j == y - 1) cout << "DA\n";
        }

    }
    return 0;
}