import collections

s = eval(input())

t = eval(input())

s = collections.Counter(s)

t = collections.Counter(t)

if sorted(s.values()) == sorted(t.values()):

  print("Yes")

else:

  print("No")

s = eval(input())

t = eval(input())



dict_st = {}

dict_ts = {}



for x, y in zip(s, t):

    if x not in dict_st:

        dict_st[x] = y 

    else:

        if dict_st[x] != y:

            print("No")

            break



    if y not in dict_ts:

        dict_ts[y]=x

    else:

        if dict_ts[y]!=x:

            print("No")

            break

else:

    print("Yes")
import collections

s = eval(input())
t = eval(input())
s = collections.Counter(s)
t = collections.Counter(t)
if sorted(s.values()) == sorted(t.values()):
    print("Yes")
else:
    print("No")

s = eval(input())
t = eval(input())
dict_st = {}
dict_ts = {}
for x, y in zip(s, t):
    if x not in dict_st:
        dict_st[x] = y
    else:
        if dict_st[x] != y:
            print("No")
            break
    if y not in dict_ts:
        dict_ts[y] = x
    else:
        if dict_ts[y] != x:
            print("No")
            break
else:
    print("Yes")

-import collections - -s = collections.Counter(s) -t = collections.Counter(t) -if sorted(s.values()) == sorted(t.values()): +dict_st = {} +dict_ts = {} +for x, y in zip(s, t): +    if x not in dict_st: +        dict_st[x] = y +    else: +        if dict_st[x] != y: +            print("No") +            break +    if y not in dict_ts: +        dict_ts[y] = x +    else: +        if dict_ts[y] != x: +            print("No") +            break +else: -else: -    print("No")