#include <bits/stdc++.h>

//vector<bool> prost(n+1,true);
//std::memset(prost1,0,sizeof(prost1));

#pragma GCC optimize("03")

using namespace std;

#define endl '\n'
#define mp make_pair
#define pb push_back
const int MAX_N=200069;
typedef long long ll;

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin>>n;
    int A[MAX_N];
    for (int i=1;i<=n;++i){
        cin>>A[i];
    }
    int q,li,ri;cin>>q;
    int countt=0;
    int uljez;
    int razlika=0;
    for (int i=1;i<=q;++i){
        cin>>li>>ri;
        for(int j=li+1;j<ri;j++){
            cout<<A[j-1]<<" "<<A[j]<<" "<<A[j+1]<<" "<<countt<<" "<<razlika<<endl;
            if(A[j-1]>A[j+1] && A[j-1]!=A[j]) {countt++;}
            if(A[j-1]>A[j+1] && A[j-1]!=A[j] && countt>1){cout<<"NE";return 0;}
            if(A[j-1]<=A[j+1] && A[j-1]<=A[j]){countt++;uljez=A[j];}

        }
        cout<<"DA";
    }

    return 0;
}