#include<iostream>usingnamespace std;typedefunsignedlonglong ULL;constint N =100010, M =70;int n, m;
ULL a[N], p[M];voidinsert(ULL x){for(int i =61; i >=0;-- i){if((x >> i)&1){if(p[i]==0){
p[i]= x;return;}
x = x ^ p[i];}}}boolquery(ULL x){for(int i =61; i >=0;-- i)if((x >> i)&1)
x = x ^ p[i];return x ==0;}intmain(){
cin >> n;for(int i =1; i <= n;++ i) cin >> a[i];
cin >> m;for(int i =1; i <= n;++ i)insert(a[i]);while(m --){
ULL x, y;
cin >> x >> y;
cout <<(query(x ^ y)==true?"YES":"NO")<< endl;}return0;}