s=list(eval(input()))

t=list(eval(input()))

S=sorted(map(s.count,set(s)))

T=sorted(map(t.count,set(t)))

print(("Yes" if S==T else "No"))

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



convert = dict()



bl = True

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

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

    bl = False

    break

  convert[s] = t



# 変換先の重複チェック

after = list(convert.values())

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

  bl = False



print(('Yes' if bl else 'No'))

s = list(eval(input()))
t = list(eval(input()))
S = sorted(map(s.count, set(s)))
T = sorted(map(t.count, set(t)))
print(("Yes" if S == T else "No"))

S, T = eval(input()), eval(input())
convert = dict()
bl = True
for s, t in zip(S, T):
    if s in convert and convert[s] != t:
        bl = False
        break
    convert[s] = t
# 変換先の重複チェック
after = list(convert.values())
if len(after) != len(set(after)):
    bl = False
print(("Yes" if bl else "No"))

-s = list(eval(input())) -t = list(eval(input())) -S = sorted(map(s.count, set(s))) -T = sorted(map(t.count, set(t))) -print(("Yes" if S == T else "No")) +S, T = eval(input()), eval(input()) +convert = dict() +bl = True +for s, t in zip(S, T): +    if s in convert and convert[s] != t: +        bl = False +        break +    convert[s] = t +# 変換先の重複チェック +after = list(convert.values()) +if len(after) != len(set(after)): +    bl = False +print(("Yes" if bl else "No"))