function main(input) {
  const args = input.split('\n');
  let ans = 'No';
  const ary1 = args[0].split(' ').map(n => parseInt(n, 10));
  const A = ary1[0];
  const B = ary1[1];
  const loop = (A >= B) ? B : A; //横回しで使う
  let aryA = [];
  let aryB = [];
  
  //必要文字のみの配列作成
  for (let i = 1; i <= A; i++) {
    aryA.push(args[i].split('').slice(0, loop));
  }
  
  for (let i = 1; i <= loop; i++) {
    aryB.push(args[A + i].split(''));
  }
  
  //重複削除
  let aryUA = uniqueAry(aryA);
  let aryUB = uniqueAry(aryB);
  
  //一致するか確認
  for (let i = 0; i < aryUB.length; i++) {
    for (let j = 0; j < aryUA.length; j++) {
      for(let k = 0; k < loop; k++) {
        if (aryUB[i][k] === aryUA[j][k]) {
          ans = 'Yes';
        }
      }
    }
  }
  
  console.log(ans);
}

function uniqueAry(ary) {
  unique_ary = ary.filter((e, index) => {
    return !ary.some((e2, index2) => {
      return index > index2 && e[0] == e2[0] && e[1] == e2[1];
    });
  });
  return unique_ary;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));