#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> g(n);
    for(int i = 1; i <= n; i++){
        cin >> g[i];
    }
    int q; cin >> q;
    int l, r;
    vector<pair<int, int>> poklon(q);
    
    for(int i = 1; i <= q; i++){
        cin >> l >> r;
        
        poklon[i] = make_pair(l, r);
    }
    for(int i = 1; i <= q; i++){
        
        int br = 0;
        for(int j = poklon[i].first; j < poklon[i].second; j++){
            int tmp = g[j];
            if(tmp > g[j+1])
                br++;
            if(br == 2){
                cout<<"NE"<<endl;
                break;
            }
        }
        if(br < 2)
            cout << "DA"<<endl;
    }
       
    return 0;
}