/******************************************
*    AUTHOR:         BHUVNESH JAIN        *
*    INSTITUITION:   BITS PILANI, PILANI  *
******************************************/
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL; 
typedef long double LD;
 
const int MAX = 3e5 + 5;
const int LIM = 1e5 + 5;
 
int a[MAX];
vector<int> freq[LIM];

int main() {
	#ifndef ONLINE_JUDGE
		freopen("inp.txt", "r", stdin);
	#endif
	int n, c, q, l, r;
	scanf("%d %d", &n, &c);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		freq[a[i]].push_back(i);
	}
	int pos, val, many;
	scanf("%d", &q);
	while(q--) {
		scanf("%d %d", &l, &r);
		bool result = false;
		for(int rep = 0; rep < 20; ++rep) {
			pos = l + rand() % (r - l + 1);
			val = a[pos];
			many = upper_bound(freq[val].begin(), freq[val].end(), r) -  lower_bound(freq[val].begin(), freq[val].end(), l);
			if (2*many > (r - l + 1)) {
				result = true;
				printf("yes %d\n", val);
				break;
			}
		}
		if (!result) printf("no\n");
	}
	return 0;
} 