def main(): data1 = str(input()) data2 = str(input()) for i in data1: flg = False for j in data2: if i==j: flg = True if not(flg): print("NO") return print("YES") if __name__ == "__main__": main()