#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int q, n;
vector<int> a;

bool isSortable (vector<int> x) {
  if(x.lenght() <= 2) return true;
  for (int i = -1; i < n; i++) {
    vector<int> temp = x;
    if(i != -1) {
      delete temp[i];
    }
    sort(temp.begin(), temp.end());
    if(temp == x) return true;
  }
  return false;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    a.pushback(temp);
  }
  
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    if (isSortable(l, r)) cout << "DA" << endl;
    else cout << "NE" << endl;
  }

  return 0;
}