#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define SZ(v) ((int)(v).size())
#define PB push_back
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define REPSZ(i,v) REP(i,SZ(v))

int n;
int want,have[1000];


void run() {
	{ int a,b; scanf("%d.%d",&a,&b); want=a*100+b; }
	scanf("%d",&n);
	REP(i,n) { scanf("%d",&have[i]); have[i]*=100; }
	
	int g=have[0]; FOR(i,1,n) g=__gcd(g,have[i]);
	while(g%2==0) g/=2;
	
	printf("%s\n",want%g==0?"yes":"no");
}


int main() {
	int n; scanf("%d",&n); FORE(i,1,n) run();
	return 0;
}
