#include <stdio.h>

int main(void) {
  int n, q, l, r;
  int flag = 0;
  scanf("%d", &n);
  int A[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d", &q);
  int L[q];
  int R[q];
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &L[i], &R[i]);
  }
  for (int i = 0; i < q; i++) {

    for (int j = L[i] - 1; j < R[i] - 2; j += 1) {
      if (A[j] > A[j + 1]) {
        flag++;
      }
    }

    if (flag > 1) {
      printf("NE\n");
    } else {
      printf("DA\n");
    }
    flag = 0;
  }
  return 0;
}