S = eval(input())

T = eval(input())

N = len(S)

 

d = {chr(i):chr(i) for i in range(97,97+26)}

 

ans = 'Yes'

for i in range(N):

    now_si = d[S[i]]

    for k,v in list(d.items()):

        if v == now_si:

            d[k] = T[i]

        elif v == T[i]:

            d[k] = now_si

 

for i in range(N):

    if d[S[i]] != T[i]:

        ans = 'No'

        break

 

 

print(ans)
S = eval(input())

T = eval(input())

N = len(S)



start = [-1 for i in range(26)]

goal = [-1 for i in range(26)]

a = ord('a')

ans = 'Yes'

for i in range(N):

    s = ord(S[i])-a

    t = ord(T[i])-a

    if start[s] != -1 or goal[t] != -1:

        if start[s] != t or goal[t] != s:

            ans = 'No'

    start[s] = t

    goal[t] = s





print(ans)

S = eval(input())
T = eval(input())
N = len(S)
d = {chr(i): chr(i) for i in range(97, 97 + 26)}
ans = "Yes"
for i in range(N):
    now_si = d[S[i]]
    for k, v in list(d.items()):
        if v == now_si:
            d[k] = T[i]
        elif v == T[i]:
            d[k] = now_si
for i in range(N):
    if d[S[i]] != T[i]:
        ans = "No"
        break
print(ans)

S = eval(input())
T = eval(input())
N = len(S)
start = [-1 for i in range(26)]
goal = [-1 for i in range(26)]
a = ord("a")
ans = "Yes"
for i in range(N):
    s = ord(S[i]) - a
    t = ord(T[i]) - a
    if start[s] != -1 or goal[t] != -1:
        if start[s] != t or goal[t] != s:
            ans = "No"
    start[s] = t
    goal[t] = s
print(ans)

-d = {chr(i): chr(i) for i in range(97, 97 + 26)} +start = [-1 for i in range(26)] +goal = [-1 for i in range(26)] +a = ord("a") -    now_si = d[S[i]] -    for k, v in list(d.items()): -        if v == now_si: -            d[k] = T[i] -        elif v == T[i]: -            d[k] = now_si -for i in range(N): -    if d[S[i]] != T[i]: -        ans = "No" -        break +    s = ord(S[i]) - a +    t = ord(T[i]) - a +    if start[s] != -1 or goal[t] != -1: +        if start[s] != t or goal[t] != s: +            ans = "No" +    start[s] = t +    goal[t] = s