A = input() B = input() X = 0 for i in range(len(A)): if A[i-1] in B: X += 1 if X == len(A): print("YES") else: print("NO")