using System;

namespace Okruzno_takmicenje___2022_02_26
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] temp = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(temp[i]);
            }
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                temp = Console.ReadLine().Split(' ');
                int l = int.Parse(temp[0]) - 1;
                int r = int.Parse(temp[1]) - 1;
                int pret = 0;
                int count = 0;
                for (int j = l; j < r; j++)
                {
                    if (a[j] >= pret) pret = a[j];
                    else if (count < 2) count++;
                    else
                    {
                        Console.WriteLine("NE");
                        break;
                    }
                }
                if (count == 1 || count == 0) Console.WriteLine("DA");
            }
        }
    }
}