def ad_list_gen(S):

    l = len(S)

    ad_list = [[] for i in range(l)]

    al_dict = {}



    for i, moji in enumerate(S):

        if moji not in al_dict:

            al_dict[moji] = i

        else:

            ad_list[al_dict[moji]].append(i)

    

    return ad_list



S = eval(input())

T = eval(input())



ad_list = ad_list_gen(S)

ad_list2 = ad_list_gen(T)

if ad_list==ad_list2:

    print('Yes')

else:

    print('No')
S = eval(input())

T = eval(input())



#ad_list = [[] for i in range(26)]

#ad_list2 = [[] for i in range(26)]

num = 97

al_dict = {}

al_dict2 = {}

new = ''

new2 = ''

for i, moji in enumerate(S):

    if moji not in al_dict:

        al_dict[moji] = i

        new += chr(num)

        num += 1

    else:

        new += new[al_dict[moji]]



num = 97



for i, moji in enumerate(T):

    if moji not in al_dict2:

        al_dict2[moji] = i

        new2 += chr(num)

        num += 1

    else:

        new2 += new2[al_dict2[moji]]



if new==new2:

    print('Yes')

else:

    print('No')
def ad_list_gen(S):
    l = len(S)
    ad_list = [[] for i in range(l)]
    al_dict = {}
    for i, moji in enumerate(S):
        if moji not in al_dict:
            al_dict[moji] = i
        else:
            ad_list[al_dict[moji]].append(i)
    return ad_list


S = eval(input())
T = eval(input())
ad_list = ad_list_gen(S)
ad_list2 = ad_list_gen(T)
if ad_list == ad_list2:
    print("Yes")
else:
    print("No")

S = eval(input())
T = eval(input())
# ad_list = [[] for i in range(26)]
# ad_list2 = [[] for i in range(26)]
num = 97
al_dict = {}
al_dict2 = {}
new = ""
new2 = ""
for i, moji in enumerate(S):
    if moji not in al_dict:
        al_dict[moji] = i
        new += chr(num)
        num += 1
    else:
        new += new[al_dict[moji]]
num = 97
for i, moji in enumerate(T):
    if moji not in al_dict2:
        al_dict2[moji] = i
        new2 += chr(num)
        num += 1
    else:
        new2 += new2[al_dict2[moji]]
if new == new2:
    print("Yes")
else:
    print("No")

-def ad_list_gen(S): -    l = len(S) -    ad_list = [[] for i in range(l)] -    al_dict = {} -    for i, moji in enumerate(S): -        if moji not in al_dict: -            al_dict[moji] = i -        else: -            ad_list[al_dict[moji]].append(i) -    return ad_list - - -ad_list = ad_list_gen(S) -ad_list2 = ad_list_gen(T) -if ad_list == ad_list2: +# ad_list = [[] for i in range(26)] +# ad_list2 = [[] for i in range(26)] +num = 97 +al_dict = {} +al_dict2 = {} +new = "" +new2 = "" +for i, moji in enumerate(S): +    if moji not in al_dict: +        al_dict[moji] = i +        new += chr(num) +        num += 1 +    else: +        new += new[al_dict[moji]] +num = 97 +for i, moji in enumerate(T): +    if moji not in al_dict2: +        al_dict2[moji] = i +        new2 += chr(num) +        num += 1 +    else: +        new2 += new2[al_dict2[moji]] +if new == new2: