#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

vector<int> pat;
vector<int> kap;

int n, c, m;
int a, b;

int find_max(){
	int t = 0;int res = 0;
	for(int i = 0; i < c; ++i){
		c = max(c, kap[i]);
		if(c == kap[i]){
			res = i;
		}
	}
	return res;
}

int main(void){
	cin>>n>>c;
	pat.resize(n);
	kap.resize(c);
	for(int i = 0; i < n; ++i){
		cin>>pat[i];
	}
	cin>>m;
	
	for(int i = 0; i < m; ++i){
		cin>>a>>b;
		for(int j = 0; j < c; ++j){
			kap[j] = 0;
		}
		for(int j = a-1; j < b; ++j){
			++kap[pat[j]-1];
		}
		//sort(kap.begin(), kap.end());
		int t = 0;int mp;
		for(int j = 0; j < c; ++j){
			t += kap[j];
		}
		mp = find_max();
		if(kap[mp] > t/2){
			cout<<"da "<<mp+1<<endl;
		}
		else{
			cout<<"ne"<<endl;
		}
	}		
	
	
	//cout<<endl;system("pause");
	return 0;
}
