/******************************************
* 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;
}
LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqICAgIEFVVEhPUjogICAgICAgICBCSFVWTkVTSCBKQUlOICAgICAgICAqCiogICAgSU5TVElUVUlUSU9OOiAgIEJJVFMgUElMQU5JLCBQSUxBTkkgICoKKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KIAp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCnR5cGVkZWYgbG9uZyBsb25nIExMOyAKdHlwZWRlZiBsb25nIGRvdWJsZSBMRDsKIApjb25zdCBpbnQgTUFYID0gM2U1ICsgNTsKY29uc3QgaW50IExJTSA9IDFlNSArIDU7CiAKaW50IGFbTUFYXTsKdmVjdG9yPGludD4gZnJlcVtMSU1dOwoKaW50IG1haW4oKSB7CgkjaWZuZGVmIE9OTElORV9KVURHRQoJCWZyZW9wZW4oImlucC50eHQiLCAiciIsIHN0ZGluKTsKCSNlbmRpZgoJaW50IG4sIGMsIHEs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