#include <bits/stdc++.h>
#define MAXN 200010

using namespace std;

typedef long long ll;

ll a[MAXN];
ll inv[MAXN];
ll br1[MAXN];
ll br2[MAXN]

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    bool samokeceviidvojke = true;
    for(int i = 1; i <= n; i++)
    {
        if(a[i] != 1 && a[i] != 2) samokeceviidvojke = false;
    }
    if(samokeceviidvojke)
    {
        for(int i = 1; i <= n; i++)
        {
            br1[i] = br1[i - 1];
            br2[i] = br2[i - 1];
            if(a[i] == 1) br1[i]++;
            if(a[i] == 2) br2[i]++;
        }
        ll q, r, l;
        cin >> q;
        while(q--)
        {
            cin >> l >> r;
            if(r - l + 1 <= 3) cout << "DA\n";
            else if(r - l <= br1[r] - br1[l - 1]) cout << "DA\n";
            else if(r - l <= br2[r] - br2[l - 1]) cout << "DA\n";
            else if(br1[l + br1[r] - br1[l - 1]] + 1 >= br1[r])  cout << "DA\n";
            else cout << "NE\n";
        }
    }
    else
    {
        for(int i = 2; i <= n; i++)
        {
            inv[i] = inv[i - 1];
            if(a[i - 1] > a[i]) inv[i]++;
        }
        ll q, r, l;
        cin >> q;
        while(q--)
        {
            cin >> l >> r;
            if(r - l + 1 <= 3) cout << "DA\n";
            else if(inv[r] - inv[l] >= 2) cout << "NE\n";
            else cout << "DA\n";
        }
    }
    return 0;
}