import itertools A = str(input().rstrip()) B = str(input().rstrip()) anagramable = ["".join(v) for v in itertools.permutations(A)] if B in anagramable: print("YES") else: print("NO")