#include <iostream>

using namespace std;

int main()
{
    long long n, i, j, q, l, r, x;
    bool ne=true;
    cin>>n;
    long long a[n];
    for (i=0; i<n; i++)
    {
        cin>>a[i];
    }
    cin>>q;
    long long b[q][n];
    for (i=0; i<q; i++)
    {
        cin>>l>>r;
        x=0;
        for (j=r-1; j<l-1; j++)
        {
            b[i][x]=a[j];
            x++;
        }
    }
    for (i=0; i<q; i++)
    {
        x=0;
        ne=true;
        while (b[i][x])
        {
            if(b[i][x+1]==0)
            break;
            if (b[i][x]>b[i][x+1])
            {
                ne=false;
                break;
            }
            x++;
        }
        if (ne)
        cout<<"DA"<<endl;
        else
        {
            ne=true;
            for (j=0; j<n; j++)
            {
                if(b[i][j+1]==0)
                break;
                
                ne=true;
                x=0;
                while (b[i][j+1])
                {
                    if (j+1==x)
                    {
                        if (b[i][j]>b[i][j+2])
                        {
                            ne=false;
                            break;
                        }
                    }
                    else if (j==x)
                    {
                        if (b[i][j+1]>b[i][j+2])
                        {
                            ne=false;
                            break;
                        }
                    }
                    else if (b[i][j]>b[i][j+1])
                    {
                        ne=false;
                        break;
                    }
                    x++;
                }
            }
            if (ne)
            cout<<"DA"<<endl;
            else
            cout<<"NE"<<endl;
            }
      }

    return 0;
}