#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    long long n;
    cin >> n;
    long long a[200000];
    for(long long i = 1; i <= n; i++) cin >> a[i];
    long long q;
    cin >> q;
    long long b[100000], c[100000];
    for(long long i = 1; i <= q; i++) 
    {
        long long br = 0;
        cin >> b[i] >> c[i];
        long long j = i;
        while(b[j] < c[j])
        {
            if(a[b[j]] > a[c[j]]) br++;
            j++;    
        }
        if(br == 0 || br == 1) cout << "DA" << endl;
        else cout << "NE" << endl;
    }
    return 0;
}