#include <bits/stdc++.h>

using namespace std;

int n, a[200005], q, l, r, br;

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

    cin >> n;
    for (int i = 1; i <= n; i++) {
         cin >> a[i];
    }
    cin >> q;
    while (q--){
         br = 0;
         cin >> l >> r;
         for (int i = l+1; i <= r; i++) {
              if (a[i] < a[i-1]) br++;
              if (br > 1) {
                  cout << "NE" << endl;
                  break;
              }
         }
         if (br <= 1) cout << "DA" << endl;
    }



return 0;
}