#include <iostream>
#include <bits/stdc++.h>


using namespace std;


bool nijeOpadajuci(const vector<int>& arr, int l, int r)
{
    int obrisan = -1; 
    for (int i = l; i < r; i++) {
        if (arr[i] < arr[i-1]) {
            if (obrisan >= 0) {
                return false; 
            }
            if (i == 1 || arr[i] >= arr[i-2]) {
      
                obrisan = i-1;
            } else {
  
                obrisan = i;
            }
        }
    }
    return true;
}

int main()
{
    int N, Q, n;
    cin >> N;
    vector<int> arr(N);
    for (int i = 0; i < N; i++)
    {
        cin >> arr[i];
    }


    cin >> Q;
    vector<int> l(Q);
    vector<int> r(Q);
    for (int i = 0; i < Q; i++)
    {
        cin >> l[i];
        cin >> r[i];
    }
    int j;
    for(j=0; j<Q; j++)
    {

        if (nijeOpadajuci(arr, l[j], r[j]))
        {
            cout << "DA" << endl;
        }
        else
        {
            cout << "NE" << endl;
        }
    }


    return 0;
}