#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i=a;i<b;i++)
#define REP(i, n) FOR(i, 0, n)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
#define YES() printf("yes\n")
#define NO() printf("no\n")
 
#define N 112345
#define T 1005
int n, m;
ll t;
ll a[N], p[T], q[T], r[T];
void mul(ll *x, ll *y){
    fill(r, r+T, 0);
    REP(i, t){
        REP(j, t){
            ll s=x[i]+y[j];
            // printf("s[%lld]+t[%lld]=%lld+%lld\n", i, j, x[i], y[j]);
            if(x[i]%t!=i) continue;
            if(y[j]%t!=j) continue;
            LAR(r[(i+j)%t], s);
    }
    }
    REP(i, t) x[i]=r[i];
}
 
int main(){
    scanf("%d%d%lld\n", &n, &m, &t);
    REP(i, n) scanf("%lld", a+i);
    fill(p, p+T, 0);
    fill(q, q+T, 0);
    REP(i, n) LAR(q[a[i]%t], a[i]);
    while(m){
        if(m%2) mul(p, q);
        // REP(i, t) printf("%2lld ", q[i]); printf("\n");
        // REP(i, t) printf("%2lld ", p[i]); printf("\n");
        mul(q, q);
        m/=2;
    }
    for(int i=t-2; i>=0; i--) LAR(p[i], p[i+1]);
    int q;
    scanf("%d", &q);
    REP(i, q){
        ll x, y;
        scanf("%lld%lld", &x, &y);
        if(p[x]%t>=x && p[x]>=t*y) YES();
        else NO();
    }
}