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

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] temp = Console.ReadLine().Split();
            int[] niz = new int[n];
            for (int i = 0; i < n; i++)
            {
                niz[i] = int.Parse(temp[i]);
            }
            int q = int.Parse(Console.ReadLine());
            int[] nizovi = new int[q*2];
            for (int i = 0; i < q; i++)
            {
                temp = Console.ReadLine().Split();
                nizovi[i] = int.Parse(temp[0]);
                nizovi[i+1] = int.Parse(temp[1]);
                int l1 = nizovi[i] - 1;
                int l2 = nizovi[i];
                int brBrisanja=0;
                while (l2 < nizovi[i+1])
                {
                    if (niz[l1] <= niz[l2])
                    {
                        l1++;
                        l2++;
                    }
                    else
                    {
                        brBrisanja++;
                        if (l1 == nizovi[i] - 1) l1++;
                        l2++;
                    }
                    if (brBrisanja > 1)
                    {
                        Console.WriteLine("NE");
                        break;
                    }
                }
                if (brBrisanja <= 1) Console.WriteLine("DA");
            }
        }
    }
}