using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
  internal class Program
  {
    static string Metoda(int[] s, int r, int l)
    {
      List<int> rlniz = new List<int>();
      for (int i = l - 1; i < r; i++)
      {
        rlniz.Add(s[i]);
      }

      for (int i = 0; i < rlniz.Count - 1; i++)
      {
        if (rlniz[i] > rlniz[i + 1])
        {
          rlniz.Remove(rlniz[i]);
          break;
        }
      }

      for (int i = 0; i < rlniz.Count - 1; i++)
      {
        if (rlniz[i] > rlniz[i + 1])
        {
          return "NE";
        }
      }
      return "DA";
    }
    
    public static void Main(string[] args)
    {
      int n = int.Parse(Console.ReadLine());
      int[] a = new int[n];
      string linija2 = Console.ReadLine();
      string[] niz = linija2.Split();
      for (int i = 0; i < n; i++)
      {
        a[i] = int.Parse(niz[i]);
      }
      int q = int.Parse(Console.ReadLine());
      int[,] rl = new int[q, 2];
      for (int i = 0; i < q; i++)
      {
        string unos = Console.ReadLine();
        string[] unostemp = unos.Split();
        rl[i, 0] = int.Parse(unostemp[0]);
        rl[i, 1] = int.Parse(unostemp[1]);
      }

      for(int i = 0; i < q; i++)
      {
        Console.WriteLine(Metoda(a, rl[i,1], rl[i,0]));
      }
    }
  }
}