#include <iostream>
 
 using namespace std;
 
 string f(int a[], int l, int r){
 	int c = 0;
 	for (int i = l; i < r; i++){
 		if (a[i] > a[i+1]){
 			c++;
		 }
		if (c == 2) return "NE";
	 }
	return "DA";
 }
 
 int main(){
 	int n;
 	cin >> n;
 	int a[200000];
 	for (int i = 0; i < n; i++){
 		cin >> a[i];
	}
	int q;
	cin >> q;
	int l[100000], r[100000];
	for (int i = 0; i < q; i++){
		cin >> l[i] >> r[i];
	}
	for (int i = 0; i < q; i++){
		cout << f(a, l[i]-1, r[i]-1) << endl;
	}
 }