'use strict'

function main(input) {
    let s = String(input.split('\n')[0].split(' ')[0]);
    let t = String(input.split('\n')[1].split(' ')[0]);
    console.log(t.includes(s) ? 'Yes' : 'No');
}

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