#include <iostream>
#include<vector>
#include<algorithm>
constexpr auto Alen = 2e5;
using namespace std;
int OdrediMax(vector<int>& B, int prethodniMax) {
    int max = -1;
   
    for (int i = 0; i < B.size(); i++) {
        if (B[i] >= prethodniMax) continue;
        if (max < B[i])max = B[i];
    }
    return max;
}
bool Rastuce(vector<int>& B, int pocetak, int kraj,int max) {
    int jumpcntr =-1;
    bool m=false;  
    for (int i = pocetak - 1; i < kraj-1; i++) {
        if (B[i] == max&& jumpcntr == -1) {
            jumpcntr=i;
            continue;
        }
        if (i + 1 == jumpcntr) {
            if (B[i] <= B[i + 2]) { m = true; continue; }
            else { return false; }
        }
        if (B[i] <= B[i + 1])m = true;
        else { return false; }
    }
    return m;

  
}
bool NeNalazi(vector<int>& B, int el) {
    if (B.size() == 0) return true;
    for (int i = 0; i < B.size();i++) {
        if (B[i] == el)return false;
    }
    return true;
}
bool Sort(vector<int>& B, int pocetak, int kraj) {
    bool m=false;
    int max = 0;
    int tmp = INT_MAX;
    vector<int> razlicitih;
    
    if (kraj - pocetak == 0) return true;
    for (int i = pocetak - 1; i <= kraj -1; i++) {
        if (NeNalazi(razlicitih,B[i])) {
            razlicitih.push_back(B[i]);
        }
    }
    for (int i = pocetak-1; i <= kraj-1; i++) {
        max = OdrediMax(razlicitih, tmp);
        tmp = max;
        m = Rastuce(B, pocetak, kraj, max);
        if (m == true) return true;
    }
    
    return false;
}
int main()
{
    int n;
    cin >> n;
    vector<int> A;
    A.reserve(n);
    int p;
    for (int i = 0; i < n; i++) {
        cin >>p;
        A.push_back(p);
    }
    int Q;
    cin >> Q;
    bool* res = new bool[Q];
    int pocetak, kraj;
    for (int i = 0; i < Q; i++) {
        cin >> pocetak >> kraj;
        res[i] = false;

        res[i] = Sort(A, pocetak, kraj);
    }
    for (int i = 0; i < Q; i++) {
        if (res[i] == true)cout << "DA" << endl;
        else cout << "NE" << endl;
    }
}