A=input() B=input() for i in A: f=False f2=False if i in B: f=True if f==False: print("NO") f2=True break if f2 == False: print("YES")