#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);

    int a[n];
    for (int i=0; i<n;i++)
       scanf("%d",&a[i]);

    int q;
    scanf("%d",&q);

    int l[q],r[q];
    int resenje[q];

    for (int i=0;i<q;i++) {
        scanf("%d %d",&l[i],&r[i]);
        int brojac=0;
        for (int j=l[i]-1;j<r[i]-1;j++)
        {
            if (a[j]>a[j+1])
                brojac++;
            if (brojac>1) {
                resenje[i]=-1;
                break;
            }
        }
        if (brojac<=1)
            resenje[i]=0;
    }
    for (int i=0;i<q;i++)
    {
        if (resenje[i]==-1)
            printf("NE\n");
        else
            printf("DA\n");
    }
    return 0;
}