using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication14
{
    class Program
    {
        static string provera(int[] A, int l, int r)
        {
            int br = 0;
            while (l < r && br<2)
            {
                if (A[l] > A[l + 1]) br++;
                l++;
            }
            if (br == 2) return "NE";
            else return "DA";
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] A = new int[n];
            for (int i = 0; i < n; i++)
            {
                A[i] = int.Parse(s[i]);
            }
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                s = Console.ReadLine().Split();
                Console.WriteLine(provera(A,int.Parse(s[0])-1,int.Parse(s[1])-1));
            }
        }
    }
}