public static void main1(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t>0){
t--;
int N,n,c;
N = in.nextInt();
n = in.nextInt();
c = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
if(dfs(a,0,c,N)) System.out.println("YES");
else System.out.println("NO");
}
}
static boolean dfs(int[] a,int index,int c,int res){
if(res<=c) return true;
if(index>=a.length) return false;
boolean flag = false;
if(res>= a[index]){
flag = dfs(a,index+1,c,res-a[index]);
}
if(flag) return flag;
flag = dfs(a,index+1,c,res);
return flag;
}
static boolean dfs(int[] a,int index,int c,int res){
if(res<=c) return true;
if(index>=a.length) return false;
boolean flag = false;
if(res>= a[index]){
flag = dfs(a,index+1,c,res-a[index]);
}
if(flag) return flag;
flag = dfs(a,index+1,c,res);
return flag;
}