#include <iostream>

using namespace std;
#define MAX 200000
#define MIN 100000
void proveri(int B[MAX],int l, int r)
{
    int brojac=0;
    while(brojac<=1&&l<=r-1)
    {
        if (B[l]>B[l+1])
            brojac++;
        l++;
    }
    if (brojac <= 1)
        cout << "DA";
    else cout << "NE";

}
int main()
{
    int N,Q,l[MIN],r[MIN],A[MAX],i;
    cin >> N;
    for(i=1; i<=N; i++)
    {
        cin >> A[i];
    }
    cin >> Q;
    for(i=0; i<Q; i++)
    {
        cin >> l[i] >> r[i];

    }
    for(i=0; i<Q; i++)
    {
        proveri(A,l[i],r[i]);
        cout<<endl;
    }
    return 0;
}