s = eval(input())

t = eval(input())

snum = []

tnum = []

for c in range(ord('a'), ord('z') + 1):

    snum.append([i for i, x in enumerate(s) if x == chr(c)])

for c in range(ord('a'), ord('z') + 1):

    tnum.append([i for i, x in enumerate(t) if x == chr(c)])

snum.sort()

tnum.sort()

print(('Yes' if snum == tnum else 'No'))
s = eval(input())

t = eval(input())

# snum = []

# tnum = []

# for c in range(ord('a'), ord('z') + 1):

#     snum.append([i for i, x in enumerate(s) if x == chr(c)])

# for c in range(ord('a'), ord('z') + 1):

#     tnum.append([i for i, x in enumerate(t) if x == chr(c)])

# snum.sort()

# tnum.sort()

# print('Yes' if snum == tnum else 'No')





sn=[0 for i in range(26)]

tn=[0 for i in range(26)]

for i in range(len(s)):

    sn[ord(s[i])-ord('a')]+=1

    tn[ord(t[i])-ord('a')]+=1

print(('Yes' if sorted(sn) == sorted(tn) else 'No'))



s = eval(input())
t = eval(input())
snum = []
tnum = []
for c in range(ord("a"), ord("z") + 1):
    snum.append([i for i, x in enumerate(s) if x == chr(c)])
for c in range(ord("a"), ord("z") + 1):
    tnum.append([i for i, x in enumerate(t) if x == chr(c)])
snum.sort()
tnum.sort()
print(("Yes" if snum == tnum else "No"))

s = eval(input())
t = eval(input())
# snum = []
# tnum = []
# for c in range(ord('a'), ord('z') + 1):
#     snum.append([i for i, x in enumerate(s) if x == chr(c)])
# for c in range(ord('a'), ord('z') + 1):
#     tnum.append([i for i, x in enumerate(t) if x == chr(c)])
# snum.sort()
# tnum.sort()
# print('Yes' if snum == tnum else 'No')
sn = [0 for i in range(26)]
tn = [0 for i in range(26)]
for i in range(len(s)):
    sn[ord(s[i]) - ord("a")] += 1
    tn[ord(t[i]) - ord("a")] += 1
print(("Yes" if sorted(sn) == sorted(tn) else "No"))

-snum = [] -tnum = [] -for c in range(ord("a"), ord("z") + 1): -    snum.append([i for i, x in enumerate(s) if x == chr(c)]) -for c in range(ord("a"), ord("z") + 1): -    tnum.append([i for i, x in enumerate(t) if x == chr(c)]) -snum.sort() -tnum.sort() -print(("Yes" if snum == tnum else "No")) +# snum = [] +# tnum = [] +# for c in range(ord('a'), ord('z') + 1): +#     snum.append([i for i, x in enumerate(s) if x == chr(c)]) +# for c in range(ord('a'), ord('z') + 1): +#     tnum.append([i for i, x in enumerate(t) if x == chr(c)]) +# snum.sort() +# tnum.sort() +# print('Yes' if snum == tnum else 'No') +sn = [0 for i in range(26)] +tn = [0 for i in range(26)] +for i in range(len(s)): +    sn[ord(s[i]) - ord("a")] += 1 +    tn[ord(t[i]) - ord("a")] += 1 +print(("Yes" if sorted(sn) == sorted(tn) else "No"))