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

namespace ConsoleApp2
{
    internal class Program
    {
        static bool Sortiranje(int[] niz)
        {
            int n = niz.Length;
            int x = 0;

            for (int i = 1; i < n; i++)
            {
                if (niz[i] < niz[i - 1])
                {
                    x++;
                    if (x > 1)
                    {
                        return false;
                    }
                    if (i > 1 && niz[i] < niz[i - 2])
                    {
                        niz[i] = niz[i - 1];
                    }
                }
            }

            return x <= 1;
        }

        static bool VecSortiran(int[] niz)
        {
            for(int i = 1;i < niz.Length; i++)
            {
                if (niz[i - 1] > niz[i]) return false;
            }
            return true;
        }

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] glavniNiz = new int[n];
            string[] s = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                glavniNiz[i] = Convert.ToInt32(s[i]);
            }

            int q = Convert.ToInt32(Console.ReadLine());
            int[] donja = new int[q];
            int[] gornja = new int[q];
            for (int i = 0; i < q; i++)
            {
                s = Console.ReadLine().Split();
                donja[i] = Convert.ToInt32(s[0]);
                gornja[i] = Convert.ToInt32(s[1]);
            }

            int[] trenutniNiz;
            for (int i = 0; i < q; i++)
            {
                trenutniNiz = new int[gornja[i] - donja[i]];
                for (int j = 0; j < trenutniNiz.Length; j++)
                {
                    trenutniNiz[j] = Convert.ToInt32(glavniNiz[j + donja[i] - 1]);
                }

                if (Sortiranje(trenutniNiz) || VecSortiran(trenutniNiz)) Console.WriteLine("DA");
                else Console.WriteLine("NE");
            }
        }
    }
}