import java.io.*;
import java.util.*;
class Main{
// N 堆石子,集合里有N个不同的整数, 每个整数的取值范围是M
static int N = 110, M = 10010;
// s 表示集合里的数字
static int[] s = new int[N], f = new int[M];
static BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
public static int sg(int x, int n){
if(f[x] != -1) return f[x];
Set<Integer> S = new HashSet();
for(int i = 0; i < n; i++){
//每次取的个数
int sum = s[i];
//每次取sum个石子, 剩余的石子个数为x - sum
if(x >= sum) S.add( sg( x - sum, n) );
}
for(int i = 0; ; i++){
if(!S.contains(i)){ //mex集合中!没!出现过的最小的非负整数
return f[x] = i;
}
}
}
public static void main(String[] args) throws Exception{
int n = Integer.valueOf(read.readLine());
String[] ss = read.readLine().split(" ");
for(int i = 0; i < n; i++){
s[i] = Integer.valueOf(ss[i]);
}
int m = Integer.valueOf(read.readLine());
Arrays.fill(f, -1);
ss = read.readLine().split(" ");
int res = 0;
for(int i = 0; i < m; i++){
//每堆石子的个数
int x = Integer.valueOf(ss[i]);
res ^= sg(x, n);
}
if(res != 0) System.out.println("Yes");
else System.out.println("No");
}
}