/// Popravi testcase za sve da su jedan ili 2


#include <bits/stdc++.h>

using namespace std;

int main()
{
    //ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int N,Q;
    cin >> N;
    vector<int>A(N);
    vector<int>s(N);
    bool tcflag = true;
    for(int i = 0; i<N; i++)
    {
        cin >> A[i];
        if(A[i] > 2)
            tcflag = false;
    }

    if(!tcflag)
    {
        s[0] = 0;
        for(int i = 1; i<N; i++)
        {
            if(A[i] < A[i-1])
                s[i] = s[i-1]+1;
            else
                s[i] = s[i-1];
        }

        /*for(int i = 0; i<N; i++)
        {
            cout << s[i] << " ";
        }
        cout << endl;*/


        cin >> Q;
        for(int i = 0; i<Q; i++)
        {
            int l,r;
            cin >> l >> r;
            l--;
            r--;
            //cout << s[r] - s[l] << endl;
            if(s[r] - s[l] > 1)
                cout << "NE" << endl;
            else
                cout << "DA" << endl;
        }
    }
    else
    {
        vector<int>s2(N);
        for(int i = 1;i<N;i++)
        {
            if(A[i] == 2 && A[i+1] == 1 && A[i-1] == 1)
                s[i] = s[i-1]+1;
            else
                s[i] = s[i-1];
            if(A[i] == 2 && A[i+1] == 1 && A[i-1] == 2)
                s2[i] = s2[i-1]+1;
            else
                s2[i] = s2[i-1];
        }

        /*for(int i = 0; i<N; i++)
        {
            cout << s[i] << " ";
        }
        cout << endl;

        for(int i = 0; i<N; i++)
        {
            cout << s2[i] << " ";
        }
        cout << endl;*/

        for(int i = 0; i<Q; i++)
        {
            int l,r;
            cin >> l >> r;
            l--;
            r--;
            //cout << s[r] - s[l] << endl;
            if(s2[r] - s2[l] == 0)
            {
                cout << "DA" << endl;
            }
            if(s2[r] - s2[l] == 1)
            {
                if(A[r] == 1 && (s2[r-1] - s2[r-2] == 1))
                    cout << "DA" << endl;
                else
                    cout << "NE" << endl;
            }
            if(s2[r] - s2[l] > 1)
            {
                cout << "NE" << endl;
            }
        }
    }

    return 0;
}