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

using namespace std;

int q, n;
vector<int> a;

vector<int> slicing(vector<int>& arr, int X, int Y) {
  auto start = arr.begin() + X;
  auto end = arr.begin() + Y + 1;
  vector<int> result(Y - X + 1);
  copy(start, end, result.begin());
  return result;
}

bool isSortable (vector<int> x) {
  if(x.size() <= 2) return true;
  for (int i = -1; i < (int)x.size(); i++) {
    vector<int> temp = x;
    if(i != -1) {
      temp.erase(temp.begin() + i);
    }
    vector<int> tempSorted = temp;
    sort(tempSorted.begin(), tempSorted.end());
    if(temp == tempSorted) return true;
    //cout << "mudja cigan" << endl;
  }
  return false;
}

int main() {
  vector<string> answers;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    a.push_back(temp);
  }
  
  cin >> q;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    vector<int> x = slicing(a, l-1, r-1);
    if (isSortable(x)) answers.push_back("DA");
    else answers.push_back("NE");
  }

  for(auto answer: answers) {
    cout << answer << endl;
  }
  return 0;
}