A = input() B = input() def check(strA, strB): for i in strA: flag = False for j in strB: if i == j: flag = True if flag == False: return False else: return True if check(A, B): print('YES') else: print('NO')