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

namespace takmicenje
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] podaci = Console.ReadLine().Split();
            int[] glavniNiz = new int[n];
            for (int i = 0; i < n; i++)
            {
                glavniNiz[i] = int.Parse(podaci[i]);
            }
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                podaci = Console.ReadLine().Split();
                int l = int.Parse(podaci[0]) - 1;
                int d = int.Parse(podaci[1]) - 1;
                int ind = 0;
                while (l < d)
                {
                    if (glavniNiz[l] > glavniNiz[l + 1])
                    {
                        ind++;
                    }
                    l++;
                    if (ind > 1) { Console.WriteLine("NE"); break; }
                }
                if (ind <= 1)
                    Console.WriteLine("DA");
            }
        }
    }
}