import itertools A = str(input().rstrip()) B = str(input().rstrip()) if tuple(B) in itertools.permutations(A): print("YES") else: print("NO")