S = list(eval(input()))

T = list(eval(input()))



answer = 'Yes'

for s in sorted(map(chr,list(range(97,123)))):

    if S.count(s) >= 2:

        l1 = [i for i, x in enumerate(S) if x == s]

        for x in l1:

            if T[x] != T[l1[0]]:

                answer = 'No'

    if T.count(s) >= 2:

        l2 = [i for i, x in enumerate(T) if x == s]

        for x in l2:

            if S[x] != S[l2[0]]:

                answer = 'No'

print(answer)
S, T = eval(input()), eval(input())



convert = dict()



answer = 'Yes'

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

    if s in convert and convert[s] != t:

        answer = 'No'

        break

    else:

        convert[s] = t



after = list(convert.values())

if len(after) != len(set(after)):

    answer = 'No'



print(answer)
S = list(eval(input()))
T = list(eval(input()))
answer = "Yes"
for s in sorted(map(chr, list(range(97, 123)))):
    if S.count(s) >= 2:
        l1 = [i for i, x in enumerate(S) if x == s]
        for x in l1:
            if T[x] != T[l1[0]]:
                answer = "No"
    if T.count(s) >= 2:
        l2 = [i for i, x in enumerate(T) if x == s]
        for x in l2:
            if S[x] != S[l2[0]]:
                answer = "No"
print(answer)

S, T = eval(input()), eval(input())
convert = dict()
answer = "Yes"
for s, t in zip(S, T):
    if s in convert and convert[s] != t:
        answer = "No"
        break
    else:
        convert[s] = t
after = list(convert.values())
if len(after) != len(set(after)):
    answer = "No"
print(answer)

-S = list(eval(input())) -T = list(eval(input())) +S, T = eval(input()), eval(input()) +convert = dict() -for s in sorted(map(chr, list(range(97, 123)))): -    if S.count(s) >= 2: -        l1 = [i for i, x in enumerate(S) if x == s] -        for x in l1: -            if T[x] != T[l1[0]]: -                answer = "No" -    if T.count(s) >= 2: -        l2 = [i for i, x in enumerate(T) if x == s] -        for x in l2: -            if S[x] != S[l2[0]]: -                answer = "No" +for s, t in zip(S, T): +    if s in convert and convert[s] != t: +        answer = "No" +        break +    else: +        convert[s] = t +after = list(convert.values()) +if len(after) != len(set(after)): +    answer = "No"