A = input() B = input() for i in A: if i in B: K = 'YES' else: K = 'NO' break print(K)