from collections import defaultdict

S, T = [x.strip() for x in open(0).read().split()]



ds, dt = defaultdict(str), defaultdict(str)

ans = 'Yes'

for s, t in zip(S, T):

    if not ds[s] or ds[s] == t:

        ds[s] = t

    else:

        ans = 'No'

        break

    if not dt[t] or dt[t] == s:

        dt[t] = s

    else:

        ans = 'No'

        break

print(ans)
S, T = input().strip(), input().strip()

ds, dt = {}, {}



for s, t in zip(S, T):

    if s not in ds or ds[s] == t:

        ds[s] = t

    else:

        print('No')

        exit()

    if t not in dt or dt[t] == s:

        dt[t] = s

    else:

        print('No')

        exit()

print('Yes')
from collections import defaultdict

S, T = [x.strip() for x in open(0).read().split()]
ds, dt = defaultdict(str), defaultdict(str)
ans = "Yes"
for s, t in zip(S, T):
    if not ds[s] or ds[s] == t:
        ds[s] = t
    else:
        ans = "No"
        break
    if not dt[t] or dt[t] == s:
        dt[t] = s
    else:
        ans = "No"
        break
print(ans)

S, T = input().strip(), input().strip()
ds, dt = {}, {}
for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        print("No")
        exit()
    if t not in dt or dt[t] == s:
        dt[t] = s
    else:
        print("No")
        exit()
print("Yes")

-from collections import defaultdict - -S, T = [x.strip() for x in open(0).read().split()] -ds, dt = defaultdict(str), defaultdict(str) -ans = "Yes" +S, T = input().strip(), input().strip() +ds, dt = {}, {} -    if not ds[s] or ds[s] == t: +    if s not in ds or ds[s] == t: -        ans = "No" -        break -    if not dt[t] or dt[t] == s: +        print("No") +        exit() +    if t not in dt or dt[t] == s: -        ans = "No" -        break -print(ans) +        print("No") +        exit() +print("Yes")