#include <bits/stdc++.h>
using namespace std;

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

    long long n, korisceno = -1, dovde = 1, q, x, y;
    cin >> n;

    vector<long long> a(n+1), dogde(n+1);
    for (long long i = 1; i <= n; i++)
        cin >> a[i];


    for (long long j = 1; j < n; j++)
    {
        if (a[j] <= a[j+1])
            dovde++;
        else if (korisceno == -1)
        {
            if (a[j+1] <= a[j])
                korisceno = j;
            else
                korisceno = j+1;
            dovde++;
        }
        else
            break;
        if (j == n-1)
            korisceno = n;
    }
    dogde[1] = dovde;


    for (long long i = 2; i < n; i++)
    {
        if (korisceno > i)
            dogde[i] = dovde;

        else if (korisceno < i)
        {
            korisceno = -1;
            for (long long j = i; j < n; j++)
            {
                if (a[j] <= a[j+1])
                    dovde = j+1;
                else if (korisceno == -1)
                {
                    korisceno = j+1;
                    dovde = j+1;
                    j++;
                }
                else
                    break;
                
                if (j == n-1)
                    korisceno = n;
            }
        }
        else if (korisceno == i)
        {
            dogde[i] = dovde;
            for (long long j = i; j < n; j++)
            {
                if (j == i)
                    dogde[i] = j+1;
                else if (a[j] <= a[j+1])
                    dogde[i] = j+1; 
                else
                    break;
                if (j == n-1)
                    korisceno = n;  
            }
            continue;
        }
        
        dogde[i] = dovde;
    }

    dogde[n] = n;
/*
    for (auto kl : dogde)
        cout << kl << '\n';
   */     
    cin >> q;

    for (int i = 0; i < q; i++)
    {
        cin >> x >> y;
        if (y <= dogde[x])
            cout << "DA" << '\n';
        else
            cout << "NE" << '\n';
    }
    return 0;
}