S = eval(input())

T = eval(input())

s = {d:[] for d in set(S)}

t = {d:[] for d in set(T)}



for i, (j,k) in enumerate(zip(S,T)):

    s[j] += [i]

    t[k] += [i]

a = sorted(s.values())

b = sorted(t.values())



print(('Yes' if a==b else "No"))
s=eval(input())

t=eval(input())

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

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

print(("Yes" if S==T else "No"))
S = eval(input())
T = eval(input())
s = {d: [] for d in set(S)}
t = {d: [] for d in set(T)}
for i, (j, k) in enumerate(zip(S, T)):
    s[j] += [i]
    t[k] += [i]
a = sorted(s.values())
b = sorted(t.values())
print(("Yes" if a == b else "No"))

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

-S = eval(input()) -T = eval(input()) -s = {d: [] for d in set(S)} -t = {d: [] for d in set(T)} -for i, (j, k) in enumerate(zip(S, T)): -    s[j] += [i] -    t[k] += [i] -a = sorted(s.values()) -b = sorted(t.values()) -print(("Yes" if a == b else "No")) +s = eval(input()) +t = eval(input()) +S = sorted(map(s.count, set(s))) +T = sorted(map(t.count, set(t))) +print(("Yes" if S == T else "No"))