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

namespace ConsoleApplication44
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int q = int.Parse(Console.ReadLine());
            bool[] t = new bool[q];
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            int k = 0;
            for (int i = 0; i < q; i++)
            {
                string []s1 = Console.ReadLine().Split();
                int p = int.Parse(s1[0])-1;
                int r = int.Parse(s1[1])-1;
                int[] b = new int[r - p+1];
                for (int j = p; j < r; j++)
                {
                    b[j] = int.Parse(s[j]);
                }
                for (int m = p; m < r; m++)
                {
                    List<int> c =new List<int>();
                    c.AddRange(b);
                    List<int> c1 = c;
                    c1.Sort();
                    if (c!=c1)
                    {
                        c.RemoveAt(m);
                        c1.RemoveAt(m);
                    }
                    else
                    {
                        t[k] = true;
                        break;
                    }
                    if (c==c1)
                    {
                        t[k] = true;
                        break;
                    }
                    else
                    {
                        t[k] = false;
                    }
                }
                k++;
            }
            for (int i = 0; i < q; i++)
            {
                if (t[i])
                {
                    Console.WriteLine("DA");
                }
                else
                {
                    Console.WriteLine("NE");
                }
            }
        }
    }
}