A = input() B = input() for i in range(len(A)): for j in range(len(B)): ans = 'NO' if B[j]==A[i]: ans = 'YES' break if ans=='NO': break print(ans)