#include <iostream>

using namespace std;

int main()
{
    int n, q, o = 0, p, k, w, l, r, x, i;
    bool d;
    bool samo12 = true;
    cin>>n;
    int a[n];
    int b[n];
    cin>>k;
    a[0] = k;
    for (i = 1; i < n; i++)
    {
        cin>>p;
        if (p != 1 && p!=2)
            samo12 = false;
        if(p<k)
        {
            b[o] = i;
            o++;
        }
        k = p;
        a[i] = k;
    }
    cin>>q;
    if(!samo12)
    {
        for (w = 0; w < q; w++)
        {
            cin>>l>>r;
            x = 0;
            d = true;
            if (r - l > 0)
            {
                for (i = 0; i < o; i++)
                {
                    if(b[i] >= l && b[i] < r)
                    {
                        x++;
                        if (x > 1)
                        {
                            d = false;
                            break;
                        }
                    }
                }
            }
            if (d)
                cout<<"DA"<<endl;
            else
                cout<<"NE"<<endl;
        }
    }
    else
    {
        for (w = 0; w < q; w++)
        {
            cin>>l>>r;
            x = 0;
            d = true;
            if (r - l > 0)
            {
                for (i = 0; i < o; i++)
                {
                    if(b[i] >= l && b[i] < r)
                    {
                        x++;
                        if (n>b[i]+1 && a[b[i]+1] == a[b[i]])
                            x++;
                        if (0 <= b[i] - 2 && a[b[i] - 1] != a[b[i] - 2])
                            x--;
                        if (b[i] == 1)
                            x--;
                        if (x > 1)
                        {
                            d = false;
                            break;
                        }
                    }
                }
            }
            if (d)
                cout<<"DA"<<endl;
            else
                cout<<"NE"<<endl;
        }
    }

    return 0;
}