#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, q;
    cin>>n;
    vector<int>a(n);
    for(int i=1; i<=n; i++){
        cin>>a[i];}
    cin>>q;
    vector<int>l(q);
    vector<int>r(q);
    for(int i=1; i<=q; i++){
        cin>>l[i]>>r[i];}
    int j=1, i=1, x=1, y=0;
    while(j<=q){
        if(r[j]==l[j] || l[j]==r[j]-1)
            {cout<<"DA"; j++;}
        else{
        x=1, y=0;
        for(i=l[j]; i<=r[j]; i++){
            if(a[i]<=a[i+1])
                {x++; y++;} else y++;}
            if(x==y || x==y-1)
                {cout<<"DA"<<x<<y<<endl; j++;}
            else {cout<<"NE"<<x<<y<<endl; j++;}}}
    return 0;
}