/// 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
    {
        bool flag = false;
        s[0] = 0;
        for(int i = 1; i<N; i++)
        {
            if(A[i] == 2 && A[i-1] == 2 && !flag)
            {
                s[i] = s[i-1]+1;
                flag = true;
            }
            else
                s[i] = s[i-1];
            if(A[i]!=2)
                flag = false;
        }

        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] >=2)
                cout << "NE" << endl;
            if(s[r] - s[l] == 0)
                cout << "DA" << endl;
            if(s[r] - s[l] == 1)
            {
                int cnt = 0;
                for(int j = r;j>=l;j--)
                {
                    if(A[j] == 1)
                    {
                        cnt++;
                    }
                    if(s[j] != s[r])
                        break;
                }
                if(cnt > 1)
                    cout << "NE" << endl;
                else
                    cout << "DA" << endl;
            }
        }
    }

    return 0;
}