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

namespace ConsoleApp2
{
    class Program
    {
        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 < s.Length; i++) // Unos
            {
                a[i] = int.Parse(s[i]);
            }
            int q = int.Parse(Console.ReadLine());
            int l, r;
            bool provera; //Da li je iskoriscen skip
            int j;
            string res = "";
            for (int i = 0; i < q; i++)
            {
                s = Console.ReadLine().Split();
                l = int.Parse(s[0]);
                r = int.Parse(s[1]);
                provera = true;
                if (l == r)
                    res += "DA" + "\n";
                else
                {
                    for (j = 0; j < r - l; j++)
                    {
                        if (a[l - 1 + j] > a[l + j])
                        {
                            if (provera)
                            {
                                provera = false;
                            }
                            else
                            {
                                res += "NE" + "\n";
                                break;
                            }
                        }
                    }
                    if (j == r - l)
                        res += "DA" + "\n";
                }
            }
            Console.WriteLine(res);
            Console.ReadLine();
        }
    }
}