#include <iostream>

using namespace std;

int main()
{
    ios_base :: sync_with_stdio(false); cin.tie(0); cout.tie(0);

    long long int n, q, i, l, r;
    cin >> n;
    long long int a[n+1];
    for(i=1;i<=n;i++)
    {
        cin >> a[i];
    }

    long long int b[n+1];
    b[1] = 0;

    for(i=2;i<=n;i++)
    {
        if(a[i]<a[i-1])
        {
            b[i] = 1;
        }
        else
        {
            b[i] = 0;
        }
    }

    for(i=1;i<=n;i++){cout << b[i]  << " ";}cout << endl;

    for(i=2;i<=n;i++)
    {
        b[i] += b[i-1];
    }

    for(i=1;i<=n;i++){cout << b[i]  << " ";}cout << endl;

    cin >> q;
    while(q--)
    {
        cin >> l >> r;

        if(b[r]-b[l]<=1)
        {
            cout << "DA" << endl;
        }
        else
        {
            cout << "NE" << endl;
        }
    }
}