#include <bits/stdc++.h>
using namespace std;

long long q,n,a[100005],l,r,br;

int main(){
  cin >> n;
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }
  cin >> q;
  for(int i = 1; i <= q; i++){
    cin >> l >> r;
    br = 0;
    for(int j = l; j < r; j++){
      cout << a[j] << " " << "|" << br << "| ";
      //if(l == r){
        //cout << "DA" << " ";
      //}
      if(a[j] > a[j+1]){
        br++;
      }
    }
    if(br >= 2){
      cout << "NE ";
      cout << br;
    }
    else{
      cout << "DA ";
      //cout << br;
    }
    cout << endl;
  }
  return 0;
}