using Microsoft.VisualBasic;
using System;
using System.Numerics;
class program
{
    static int Main()
    {
        Int64 n = int.Parse(Console.ReadLine());
        Int64[] niz = new Int64[n];

        var linija = Console.ReadLine().Split();
        for (int i=0;i<n;i++)
        {
            niz[i] = Int64.Parse(linija[i]);
        }
        Int64 q = int.Parse(Console.ReadLine());
        Int64[] poklonjeniL = new Int64[q];
        Int64[] poklonjeniR = new Int64[q]; 

        
        for (int i=0;i<q;i++)
        {
            var linija1 = Console.ReadLine().Split();
            Int64 l = Int64.Parse(linija1[0]);
            poklonjeniL[i] = l;
            Int64 r = Int64.Parse(linija1[1]);
            poklonjeniR[i] = r;
        }


        Int64[] B = new Int64[n];
        Array.Copy(niz, 0, B, 0, niz.Length);
        Array.Sort(B);     
        int br1 = 0;
        for (int d=0;d<n;d++)
        {
            if (B[d] == niz[d])
            {
                br1++;  
            }
            
            
        }
        if (br1 == n)
        {
            for (int i = 0; i < q; i++)
            {
                Console.WriteLine("DA");
            }
            return 0;
        }
        
        Int64 br = 0;
        for (Int64 j = 0; j < q; j++)
        {
            for (Int64 i = poklonjeniL[j] - 1; i < poklonjeniR[j] - 1; i++)
            {
                for (Int64 d = i+1; d <= poklonjeniR[j]-1;d++)
                {
                    if (niz[i] > niz[d])
                    {
                        br++;
                        

                    }
                }
                
            }
            if (br > 1)
            {
                Console.WriteLine("NE");
               
            }
            else 
            {
                Console.WriteLine("DA");
            }

            br = 0;

        }
        
        

        
        return 0;

    }
}