You are given strings S and T consisting of lowercase English letters.
You can perform the following operation on S any number of times:
Operation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.
Determine if S and T can be made equal by performing the operation zero or more times.

-----Constraints-----
 - 1 \leq |S| \leq 2 \times 10^5
 - |S| = |T|
 - S and T consists of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
S
T

-----Output-----
If S and T can be made equal, print Yes; otherwise, print No.

-----Sample Input-----
azzel
apple

-----Sample Output-----
Yes

azzel can be changed to apple, as follows:
 - Choose e as c_1 and l as c_2. azzel becomes azzle.
 - Choose z as c_1 and p as c_2. azzle becomes apple.

Difficulty: EASY

Solutions:
S = input()
T = input()
a = list((S.count(chr(ord('a') + i)) for i in range(26)))
b = list((T.count(chr(ord('a') + i)) for i in range(26)))
a.sort()
b.sort()
if a == b:
	print('Yes')
else:
	print('No')


def f():
	w = input()
	return sorted((w.count(c) for c in set(w)))
print('YNeos'[f() != f()::2])


def solve():
	from collections import Counter
	s = [i for i in sorted(Counter(input()).values())]
	t = [i for i in sorted(Counter(input()).values())]
	print(['No', 'Yes'][s == t])
solve()


from collections import Counter
S = input()
T = input()
CS = Counter(S).most_common()
CT = Counter(T).most_common()
for (XS, XT) in zip(CS, CT):
	if XS[1] != XT[1]:
		print('No')
		break
else:
	print('Yes')


from collections import Counter
S = list(input())
T = list(input())
change = [-1] * 27
ans = 'Yes'
for i in range(len(S)):
	s = ord(S[i]) - 97
	if S[i] == T[i]:
		change[s] = s
	elif change[s] == -1:
		change[s] = ord(T[i]) - 97
	else:
		t = ord(T[i]) - 97
		if change[s] != t:
			ans = 'No'
			break
change = Counter(change)
del change[-1]
for i in change.values():
	if i == 1:
		continue
	else:
		ans = 'No'
print(ans)


from collections import Counter
sc = Counter(input())
tc = Counter(input())
for (s, t) in zip(sorted(sc.values()), sorted(tc.values())):
	if s != t:
		print('No')
		break
else:
	print('Yes')


s = input()
t = input()
s = sorted([s.count(i) for i in set(s)])
t = sorted([t.count(i) for i in set(t)])
if s == t:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
s_c = sorted(Counter(s).values())
t_c = sorted(Counter(t).values())
if s_c == t_c:
	print('Yes')
else:
	print('No')


S = input()
T = input()
mydict = {}
for i in range(len(S)):
	if S[i] in mydict:
		if T[i] != mydict[S[i]]:
			ans = 'No'
			break
	else:
		mydict[S[i]] = T[i]
else:
	a = list(mydict.values())
	b = list(set(a))
	if len(b) != len(a):
		ans = 'No'
	else:
		ans = 'Yes'
print(ans)


from collections import Counter
S = sorted(Counter(input()).values())
T = sorted(Counter(input()).values())
if S == T:
	print('Yes')
else:
	print('No')


import sys
stdin = sys.stdin

def ns():
	return stdin.readline().rstrip()

def ni():
	return int(stdin.readline().rstrip())

def nm():
	return list(map(int, stdin.readline().split()))

def nl():
	return list(map(int, stdin.readline().split()))

def main():
	s = input()
	t = input()
	S = sorted(map(s.count, set(s)))
	T = sorted(map(t.count, set(t)))
	print('Yes' if S == T else 'No')

def __starting_point():
	main()
__starting_point()


S = input()
T = input()
alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
S_counter = []
T_counter = []
for i in alph:
	S_counter.append(S.count(i))
	T_counter.append(T.count(i))
S_counter.sort()
T_counter.sort()
if S_counter == T_counter:
	print('Yes')
else:
	print('No')


s = input()
t = input()
n = len(s)
x = []
y = []
for i in range(n):
	if s[i] not in x:
		x.append(s[i])
	if t[i] not in y:
		y.append(t[i])
for i in range(len(x)):
	s = s.replace(x[i], str(i))
for i in range(len(y)):
	t = t.replace(y[i], str(i))
print('Yes' if s == t else 'No')


from collections import Counter as C
(s, t) = (input(), input())
print('No') if C(C(s).values()) != C(C(t).values()) else print('Yes')


import collections as cl
s = input()
t = input()
s_count = cl.Counter(s)
t_count = cl.Counter(t)
a = sorted(s_count.values())
b = sorted(t_count.values())
if a == b:
	print('Yes')
else:
	print('No')


from collections import Counter
import io
import math
sam = sorted(Counter(input()).values())
tim = sorted(Counter(input()).values())
print('Yes' if tim == sam else 'No')


s = input()
t = input()
sset = set()
tset = set()
j = 1
alp = {}
ds = [0] * len(s)
for i in range(len(s)):
	if not s[i] in sset:
		alp[s[i]] = j
		ds[i] = j
		sset.add(s[i])
		j += 1
	else:
		ds[i] = alp[s[i]]
j = 1
alp = {}
dt = [0] * len(t)
for i in range(len(t)):
	if not t[i] in tset:
		alp[t[i]] = j
		dt[i] = j
		tset.add(t[i])
		j += 1
	else:
		dt[i] = alp[t[i]]
for i in range(len(s)):
	if ds[i] != dt[i]:
		print('No')
		return
print('Yes')


S = input()
T = input()
(s, t) = ([], [])
for alp in 'abcdefghijklmnopqrstuvwxyz':
	s.append(S.count(alp))
	t.append(T.count(alp))
if sorted(s) == sorted(t):
	print('Yes')
else:
	print('No')


s = input()
t = input()
sl = len(s)
ss = ''
used = [False] * 26
cnt = 0
for i in range(sl):
	if used[(ord(s[i]) - 97) % 26]:
		ss += str(used[(ord(s[i]) - 97) % 26])
	else:
		cnt += 1
		ss += str(cnt)
		used[(ord(s[i]) - 97) % 26] = cnt
used = [False] * 26
tt = ''
cnt = 0
for i in range(sl):
	if used[(ord(t[i]) - 97) % 26]:
		tt += str(used[(ord(t[i]) - 97) % 26])
	else:
		cnt += 1
		tt += str(cnt)
		used[(ord(t[i]) - 97) % 26] = cnt
if ss == tt:
	print('Yes')
else:
	print('No')


from collections import Counter
s = Counter(input())
a = [i for i in s.values()]
t = Counter(input())
b = [i for i in t.values()]
if sorted(a) == sorted(b):
	print('Yes')
else:
	print('No')


s = list(input())
t = list(input())
n = len(s)
s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]
for i in range(n):
	for j in range(i):
		if s[i] == s[j]:
			s_par[i] = s_par[j]
			break
for i in range(n):
	for j in range(i):
		if t[i] == t[j]:
			t_par[i] = t_par[j]
			break
if s_par == t_par:
	print('Yes')
else:
	print('No')


import bisect, collections, copy, itertools, math, string
import sys

def I():
	return int(sys.stdin.readline().rstrip())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def S():
	return sys.stdin.readline().rstrip()

def LS():
	return list(sys.stdin.readline().rstrip().split())

def main():
	s = S()
	t = S()
	dic1 = collections.defaultdict(str)
	dic2 = collections.defaultdict(str)
	for i in range(len(s)):
		if dic1[t[i]] == '':
			dic1[t[i]] = s[i]
		elif dic1[t[i]] != s[i]:
			print('No')
			return
		if dic2[s[i]] == '':
			dic2[s[i]] = t[i]
		elif dic2[s[i]] != t[i]:
			print('No')
			return
	print('Yes')
main()


s = input()
t = input()
s_map = [[] for i in range(26)]
t_map = [[] for i in range(26)]
n = len(s)
for i in range(n):
	si = ord(s[i]) - ord('a')
	ti = ord(t[i]) - ord('a')
	s_map[si].append(i)
	t_map[ti].append(i)
s_map = sorted(s_map)
t_map = sorted(t_map)
if s_map == t_map:
	print('Yes')
else:
	print('No')


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


from collections import Counter
s = list(input())
t = list(input())
s_count = Counter(s)
t_count = Counter(t)
if sorted(s_count.values()) == sorted(t_count.values()):
	print('Yes')
else:
	print('No')


s = input()
t = input()
n = len(s)
f = 0
a = [[] for i in range(26)]
for i in range(n):
	if len(a[ord(s[i]) - 97]) == 0:
		a[ord(s[i]) - 97].append(t[i])
	elif a[ord(s[i]) - 97][0] != t[i]:
		f = 1
x = [a[i][0] for i in range(26) if len(a[i]) == 1]
if len(x) != len(set(x)):
	f = 1
print('Yes' if f == 0 else 'No')


from collections import defaultdict
s = input()
t = input()
n = len(s)
d = defaultdict(str)
for i in range(n):
	if d[t[i]] == '':
		d[t[i]] = s[i]
	elif d[t[i]] != s[i]:
		print('No')
		return
d.clear()
for i in range(n):
	if d[s[i]] == '':
		d[s[i]] = t[i]
	elif d[s[i]] != t[i]:
		print('No')
		return
print('Yes')


from collections import Counter
S = input()
T = input()
scnt = sorted(list(Counter(S).values()))
tcnt = sorted(list(Counter(T).values()))
print('Yes' if scnt == tcnt else 'No')


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


A = list()
B = list()
for i in range(26):
	A.append(list())
	B.append(list())
S = input()
T = input()

def solve():
	for i in range(len(S)):
		index = ord(S[i]) - ord('a')
		A[index].append(i)
	for a_lis in A:
		flag = False
		if a_lis:
			tmp = T[a_lis[0]]
		for t in a_lis:
			if T[t] != tmp:
				flag = True
		if flag:
			print('No')
			return
	for i in range(len(T)):
		index = ord(T[i]) - ord('a')
		B[index].append(i)
	for b_lis in B:
		flag = False
		if b_lis:
			tmp = S[b_lis[0]]
		for t in b_lis:
			if S[t] != tmp:
				flag = True
		if flag:
			print('No')
			return
	print('Yes')
	return
solve()


S = input()
T = input()
s_let = [0] * 26
t_let = [0] * 26
ans = 'Yes'
for i in range(len(S)):
	s_let[ord(S[i]) - ord('a')] += 1
for j in range(len(T)):
	t_let[ord(T[j]) - ord('a')] += 1
s_let.sort()
t_let.sort()
for k in range(26):
	if s_let[k] != t_let[k]:
		ans = 'No'
print(ans)


a = input()
b = input()
while 1:
	if a == '':
		break
	a = a.replace(a[0], '')
	b = b.replace(b[0], '')
	if len(a) != len(b):
		print('No')
		exit()
print('Yes')


from collections import Counter as C
print('YNeos'[C(C(input()).values()) != C(C(input()).values())::2])


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


import sys
from collections import Counter

def main():
	s = input()
	t = input()
	s_count = [0] * 26
	t_count = [0] * 26
	for i in range(ord('a'), ord('z') + 1):
		s_count[i - 97] = s.count(chr(i))
		t_count[i - 97] = t.count(chr(i))
	s_count.sort()
	t_count.sort()
	if s_count == t_count:
		print('Yes')
	else:
		print('No')

def __starting_point():
	main()
__starting_point()


s = input()
t = input()
l = len(s)
cs = [0] * 26
ct = [0] * 26
for i in range(l):
	cs[ord(s[i]) - ord('a')] += 1
	ct[ord(t[i]) - ord('a')] += 1
cs.sort()
ct.sort()
if cs == ct:
	print('Yes')
else:
	print('No')


from collections import Counter
S = input()
T = input()
a = sorted([i for i in Counter(S).values()])
b = sorted([i for i in Counter(T).values()])
if a == b:
	print('Yes')
else:
	print('No')


s = input()
t = input()
d = {}
l = []
for i in range(len(s)):
	if s[i] in d and d[s[i]] != t[i]:
		print('No')
		exit()
	d[s[i]] = t[i]
if len(d.values()) != len(set(d.values())):
	print('No')
	exit()
print('Yes')


from collections import Counter
s = input()
t = input()
ds = Counter(list(s))
ts = Counter(list(t))
print('Yes') if sorted(ds.values()) == sorted(ts.values()) else print('No')


S = list(input())
T = list(input())
S_list = list(set(list(S)))
T_list = list(set(list(T)))
print('Yes' if sorted([S.count(i) for i in S_list]) == sorted([T.count(i) for i in T_list]) else 'No')


from collections import Counter as Ct
print('Yes' if sorted(Ct(input()).values()) == sorted(Ct(input()).values()) else 'No')


from collections import Counter as C

def cnt(x):
	return sorted(C(x).values())
s = list(input())
t = list(input())
if cnt(s) == cnt(t):
	print('Yes')
else:
	print('No')


s = input()
t = input()
c_s = sorted([s.count(_c) for _c in set(s)])
c_t = sorted([t.count(_c) for _c in set(t)])
if c_s == c_t:
	print('Yes')
else:
	print('No')


s = input()
t = input()
sl = []
tl = []
for c in 'abcdefghijklmnopqrstuvwxyz':
	sl.append(s.count(c))
	tl.append(t.count(c))
if sorted(sl) == sorted(tl):
	print('Yes')
else:
	print('No')


from collections import Counter
s = Counter(input())
t = Counter(input())
sv = sorted(s.values())
tv = sorted(t.values())
if sv == tv:
	print('Yes')
else:
	print('No')


from collections import Counter
(s, t) = (input(), input())
(Sc, Tc) = (Counter(s), Counter(t))
if sorted(Sc.values()) == sorted(Tc.values()):
	print('Yes')
else:
	print('No')


s = input()
t = input()

def char_list(s):
	l = [0] * 26
	for x in s:
		i = ord(x) - ord('a')
		l[i] += 1
	l.sort()
	return l
l1 = char_list(s)
l2 = char_list(t)
if l1 == l2:
	print('Yes')
else:
	print('No')


S = input()
T = input()
N = len(S)
count = 0
R_1 = [-1 for i in range(26)]
R_2 = [-1 for i in range(26)]
answer = 'Yes'
for i in range(N):
	r1 = ord(S[i]) - 97
	r2 = ord(T[i]) - 97
	if R_1[r1] >= 0:
		if r2 != R_1[r1]:
			answer = 'No'
			break
	if R_2[r2] >= 0:
		if r1 != R_2[r2]:
			answer = 'No'
			break
	if R_1[r1] < 0:
		R_1[r1] = r2
	if R_2[r2] < 0:
		R_2[r2] = r1
print(answer)


s = list(input())
t = list(input())
n = len(s)
s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

def operation(x, par):
	for i in range(n):
		for j in range(i):
			if x[i] == x[j]:
				par[i] = par[j]
				break
	return par
if operation(s, s_par) == operation(t, t_par):
	print('Yes')
else:
	print('No')


from collections import Counter
s = Counter(input()).most_common()
t = Counter(input()).most_common()
ans = 'Yes'
for i in range(min(len(s), len(t))):
	if s[i][1] != t[i][1]:
		ans = 'No'
print(ans)


from collections import Counter as c
s = input()
S = c(s)
t = input()
T = c(t)
if sorted(S.values()) == sorted(T.values()):
	print('Yes')
else:
	print('No')


from collections import Counter
s = Counter(input())
t = Counter(input())
s_n = sorted([x for x in s.values()])
t_n = sorted([x for x in t.values()])
print('Yes' if s_n == t_n else 'No')


from collections import Counter as C
print(['No', 'Yes'][C(C(input()).values()) == C(C(input()).values())])


from collections import Counter
s = input()
t = input()
list_S = Counter(s)
list_T = Counter(t)
if sorted(list_S.values()) == sorted(list_T.values()):
	print('Yes')
else:
	print('No')


from collections import Counter
S = str(input())
T = str(input())
s = Counter(S)
t = Counter(T)
if sorted(s.values()) == sorted(t.values()):
	print('Yes')
else:
	print('No')


import collections
A = input()
B = input()
A_c = collections.Counter(A)
B_c = collections.Counter(B)
A_c = list(A_c.values())
B_c = list(B_c.values())
A_c = list(A_c)
B_c = list(B_c)
A_c.sort()
B_c.sort()
if A_c == B_c:
	print('Yes')
else:
	print('No')


from collections import Counter
S = list(input())
T = list(input())
a = Counter(S).most_common()
b = Counter(T).most_common()
for i in range(len(a)):
	if a[i][1] != b[i][1]:
		print('No')
		exit()
else:
	print('Yes')


s = input()
t = input()
s = sorted(map(s.count, set(s)))
t = sorted(map(t.count, set(t)))
print('Yes' if s == t else 'No')


S = input()
T = input()
for i in range(len(S)):
	if S.find(S[i]) != T.find(T[i]):
		print('No')
		exit()
print('Yes')


from collections import Counter
s = input()
t = input()
count_s = Counter(Counter(s).values())
count_t = Counter(Counter(t).values())
if count_s == count_t:
	print('Yes')
else:
	print('No')


S = input()
T = input()
sidx = [S.find(S[i]) for i in range(len(S))]
tidx = [T.find(T[i]) for i in range(len(T))]
if sidx == tidx:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
cnt_s = sorted(Counter(s).values())
cnt_t = sorted(Counter(t).values())
print('Yes' if cnt_s == cnt_t else 'No')


(s, t) = ([0] * 26, [0] * 26)
for (a, b) in zip(input(), input()):
	s[ord(a) - ord('a')] += 1
	t[ord(b) - ord('a')] += 1
(u, v) = ([], [])
for (a, b) in zip(s, t):
	if a != b:
		u.append(a)
		v.append(b)
print('YNeos'[sorted(u) != sorted(v)::2])


import collections
s = input()
t = input()
print('Yes' if sorted(collections.Counter(s).values()) == sorted(collections.Counter(t).values()) else 'No')


def check(s, t):
	from collections import Counter
	sc = Counter(s)
	tc = Counter(t)
	return sorted(sc.values()) == sorted(tc.values())
print(['No', 'Yes'][check(input(), input())])


def p(S):
	D = {}
	for i in range(len(S)):
		a = S[i]
		if a in D:
			D[a].add(i)
		else:
			D[a] = {i}
	return D
S = input()
T = input()
A = sorted(p(S).values())
B = sorted(p(T).values())
if A == B:
	print('Yes')
else:
	print('No')


s = list(input())
t = list(input())
ss = len(set(s))
tt = len(set(t))
l = []
for (i, j) in zip(s, t):
	l.append(i + j)
if len(set(l)) == ss == tt:
	print('Yes')
else:
	print('No')


S = input()
T = input()
ls = [0] * 26
lt = [0] * 26
for s in S:
	ls[ord(s) - 97] += 1
for t in T:
	lt[ord(t) - 97] += 1
ls.sort()
lt.sort()
if ls == lt:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
ss = sorted(Counter(s).values())
st = sorted(Counter(t).values())
print('Yes') if ss == st else print('No')


from collections import Counter as cnt
fnc = lambda : cnt(cnt(input()).values())
print('Yes' if fnc() == fnc() else 'No')


from collections import Counter
s = input()
t = input()
cntS = list(Counter(s).values())
cntT = list(Counter(t).values())
cntS.sort()
cntT.sort()
print('Yes' if cntS == cntT else 'No')


from collections import Counter
S = input()
T = input()
S = list(Counter(S).values())
T = list(Counter(T).values())
S.sort()
T.sort()
if S == T:
	print('Yes')
else:
	print('No')


from collections import Counter
s = list(input())
t = list(input())
sc = Counter(s).values()
tc = Counter(t).values()
sl = Counter(sc)
tl = Counter(tc)
if sl == tl:
	print('Yes')
else:
	print('No')


from collections import Counter
s1 = sorted(list(dict(Counter(input())).values()))
t1 = sorted(list(dict(Counter(input())).values()))
print(['No', 'Yes'][s1 == t1])


from collections import Counter
x = lambda : sorted(Counter(input()).values())
print('YNeos'[x() != x()::2])


import sys
from collections import Counter
input = sys.stdin.readline

def main():
	S = input().rstrip()
	T = input().rstrip()
	c_S = Counter(S)
	c_T = Counter(T)
	count_S = list(c_S.values())
	count_T = list(c_T.values())
	count_S.sort()
	count_T.sort()
	is_same = True
	for (s, t) in zip(count_S, count_T):
		if s != t:
			is_same = False
			break
	ans = 'Yes' if is_same else 'No'
	print(ans)

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline
S = input().strip()
T = input().strip()
index_s = {}
index_t = {}
for i in range(len(S)):
	if T[i] in index_t:
		if index_t[T[i]] != S[i]:
			print('No')
			return
	else:
		index_t[T[i]] = S[i]
	if S[i] in index_s:
		if index_s[S[i]] != T[i]:
			print('No')
			return
	else:
		index_s[S[i]] = T[i]
print('Yes')


(S, T) = ([0] * 26, [0] * 26)
for s in input():
	S[ord(s) - ord('a')] += 1
for t in input():
	T[ord(t) - ord('a')] += 1
S.sort()
T.sort()
ans = 'Yes' if S == T else 'No'
print(ans)


s = input()
t = input()
sc = {}
tc = {}
for i in range(len(s)):
	if s[i] in sc:
		sc[s[i]].append(i)
	else:
		sc[s[i]] = [i]
	if t[i] in tc:
		tc[t[i]].append(i)
	else:
		tc[t[i]] = [i]
sc = list(sc.values())
tc = list(tc.values())
print('Yes' if sc == tc else 'No')


from collections import Counter
s = input()
t = input()
cs = Counter(s)
ct = Counter(t)
if sorted(cs.values()) == sorted(ct.values()):
	print('Yes')
else:
	print('No')


from collections import Counter
s = Counter(input())
t = Counter(input())
ans = 'Yes'
for (x, y) in zip(s.items(), t.items()):
	if x[1] != y[1]:
		ans = 'No'
print(ans)


s = input()
t = input()
ds = {}
dt = {}
ans = 'Yes'
for (S, T) in zip(s, t):
	if S in ds:
		if ds[S] != T:
			ans = 'No'
			break
	else:
		ds[S] = T
	if T in dt:
		if dt[T] != S:
			ans = 'No'
			break
	else:
		dt[T] = S
print(ans)


s = input()
t = input()
d = []
for l in [s, t]:
	ptr = 0
	dct = dict()
	for c in l:
		if c not in list(dct.keys()):
			dct[c] = chr(ord('A') + ptr)
			ptr += 1
	d.append([dct[c] for c in l])
print('Yes' if ''.join(d[0]) == ''.join(d[1]) else 'No')


import collections
s = input()
t = input()
sc = sorted(collections.Counter(s).values())
tc = sorted(collections.Counter(t).values())
for i in range(len(sc)):
	if sc[i] != tc[i]:
		print('No')
		return
print('Yes')


from collections import *
(s, t) = (Counter(input()), Counter(input()))
print('YNeos'[sorted(s.values()) != sorted(t.values())::2])


s = input()
t = input()
sl = list(s)
tl = list(t)
from collections import Counter
sc = Counter(sl)
tc = Counter(tl)
sp = []
tp = []
alp = 'abcdefghijklmnopqrstuvwxyz'
for i in alp:
	sp.append(sc[i])
	tp.append(tc[i])
sps = sorted(sp)
tps = sorted(tp)
for (i, j) in zip(sps, tps):
	if i == j:
		pass
	else:
		print('No')
		return
print('Yes')


(ds, dt) = (dict(), dict())
for (s, t) in zip(input(), input()):
	if t in ds and ds[t] != s or (s in dt and dt[s] != t):
		print('No')
		break
	ds[t] = s
	dt[s] = t
else:
	print('Yes')


S = input()
T = input()
d = [[] for i in range(26)]
for (i, c) in enumerate(S):
	d[ord(c) - ord('a')].append(i)
d2 = [[] for i in range(26)]
for (i, c) in enumerate(T):
	d2[ord(c) - ord('a')].append(i)
print(['No', 'Yes'][set((tuple(x) for x in d)) == set((tuple(x) for x in d2))])


a = list(input())
b = list(input())
from collections import Counter

def f(s):
	return sorted(Counter(s).values())
if f(a) == f(b):
	print('Yes')
else:
	print('No')


import collections
S = list(input())
T = list(input())
counterS = collections.Counter(S)
counterT = collections.Counter(T)
Scou = list(counterS.values())
Tcou = list(counterT.values())
Scou.sort()
Tcou.sort()
if Scou == Tcou:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
c1 = Counter(s).most_common()
c2 = Counter(t).most_common()
for (x, y) in zip(c1, c2):
	if x[1] != y[1]:
		print('No')
		break
else:
	print('Yes')


from collections import Counter
s = input()
t = input()
c1 = Counter(s)
c2 = Counter(t)
if sorted(c1.values()) == sorted(c2.values()):
	print('Yes')
else:
	print('No')


S = input()
T = input()
D1 = {}
D2 = {}
ans = 1
for (s, t) in zip(S, T):
	x = D1.get(t, '')
	if x == '':
		D1[t] = s
	elif x != s:
		ans = 0
		break
	x = D2.get(s, '')
	if x == '':
		D2[s] = t
	elif x != t:
		ans = 0
		break
print('Yes' if ans else 'No')


s = list(input())
t = list(input())
n = len(s)
a = [s.count(chr(97 + i)) for i in range(26)]
b = [t.count(chr(97 + i)) for i in range(26)]
if all((a[ord(s[i]) - 97] == b[ord(t[i]) - 97] for i in range(n))):
	print('Yes')
else:
	print('No')


s = list(input())
t = list(input())
A = []
B = []
count = 0
for (i, j) in zip(s, t):
	if s.index(i) != t.index(j):
		print('No')
		count += 1
		break
if count == 0:
	print('Yes')


S = input()
T = input()
U = [[i, j] for (i, j) in zip(S, T)]
U.sort()
s = U[0][0]
t = U[0][1]
for (i, j) in U:
	if i != s:
		s = i
		t = j
	elif j != t:
		print('No')
		return
U.sort(key=lambda x: x[1])
s = U[0][0]
t = U[0][1]
for (i, j) in U:
	if j != t:
		s = i
		t = j
	elif i != s:
		print('No')
		return
print('Yes')


import sys

def input():
	return sys.stdin.readline().rstrip()

def main():
	S = input()
	T = input()
	dictS = dict()
	dictT = dict()
	for i in range(len(S)):
		if S[i] in dictS:
			if dictS[S[i]] != T[i]:
				print('No')
				return
		else:
			dictS[S[i]] = T[i]
		if T[i] in dictT:
			if dictT[T[i]] != S[i]:
				print('No')
				return
		else:
			dictT[T[i]] = S[i]
	print('Yes')

def __starting_point():
	main()
__starting_point()


import collections
S = list(input())
T = list(input())
cntS = collections.Counter(S)
cntT = collections.Counter(T)
if len(cntS) != len(cntT):
	print('No')
	return
else:
	valS = list(cntS.values())
	valT = list(cntT.values())
	if valS != valT:
		print('No')
		return
print('Yes')


import sys
s = list(input())
t = list(input())
a = [-1 for _ in range(26)]
b = [-1 for _ in range(26)]
for i in range(len(s)):
	(num0, num1) = (a[ord(s[i]) - 97], b[ord(t[i]) - 97])
	if num0 >= 0:
		if chr(num0 + 97) != t[i]:
			print('No')
			return
	else:
		a[ord(s[i]) - 97] = ord(t[i]) - 97
	if num1 >= 0:
		if chr(num1 + 97) != s[i]:
			print('No')
			return
	else:
		b[ord(t[i]) - 97] = ord(s[i]) - 97
print('Yes')


import collections
S = input()
T = input()
a1 = collections.Counter(S)
a2 = collections.Counter(T)
x = ''
for i in range(len(S)):
	if a1[S[i]] != a2[T[i]]:
		x = 'No'
if x == '':
	print('Yes')
else:
	print(x)


s = input()
t = input()
ss = []
tt = []
for i in 'abcdefghijklmnopqrstuvwxyz':
	ss.append(s.count(i))
	tt.append(t.count(i))
if sorted(ss) == sorted(tt):
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
sc = Counter(s)
tc = Counter(t)
if sorted(sc.values()) == sorted(tc.values()):
	print('Yes')
else:
	print('No')


import collections
s = input()
t = input()
S = sorted(list(collections.Counter(s).values()))
T = sorted(list(collections.Counter(t).values()))
if S == T:
	print('Yes')
else:
	print('No')


from collections import Counter
cs = Counter(input())
cn = Counter(input())
cs = sorted(cs.values())
cn = sorted(cn.values())
print('Yes') if cs == cn else print('No')


s = input()
t = input()
sn = [0 for i in range(26)]
tn = [0 for i in range(26)]
for i in range(len(s)):
	sn[ord(s[i]) - ord('a')] += 1
	tn[ord(t[i]) - ord('a')] += 1
print('Yes' if sorted(sn) == sorted(tn) else 'No')


import collections as c
i = lambda : c.Counter(c.Counter(input()).values())
print('YNeos'[i() != i()::2])


s = input()
t = input()
l_s = [[] for _ in range(26)]
for (i, x) in enumerate(s):
	l_s[ord(x) - 97].append(i)
l_t = [[] for _ in range(26)]
for (i, x) in enumerate(t):
	l_t[ord(x) - 97].append(i)
for l in l_s:
	if len(l) > 0:
		if l_t[ord(t[l[0]]) - 97] != l:
			print('No')
			return
print('Yes')


from collections import *
C = Counter
i = lambda : C(C(input()).values())
print('YNeos'[i() != i()::2])


from collections import Counter

def main():
	S = input()
	T = input()
	s = sorted(Counter(S).values())
	t = sorted(Counter(T).values())
	return 'Yes' if s == t else 'No'
print(main())


s = input()
t = input()
d = {}
for (si, ti) in zip(s, t):
	if si in d and d[si] != ti:
		print('No')
		exit()
	d[si] = ti
l = len(set(d.values()))
print('Yes' if len(d) == l else 'No')


s = input()
t = input()
sc = [0] * 26
tc = [0] * 26
for i in range(len(s)):
	sc[ord(s[i]) - ord('a')] += 1
	tc[ord(t[i]) - ord('a')] += 1
sc.sort()
tc.sort()
if tuple(sc) == tuple(tc):
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
c1 = Counter(s).most_common()
c2 = Counter(t).most_common()
for (i, j) in zip(c1, c2):
	if i[1] != j[1]:
		print('No')
		break
else:
	print('Yes')


def f():
	i = input()
	return sorted((i.count(j) for j in set(i)))
print('YNeos'[f() != f()::2])


s = input()
t = input()
memo = {}
ans = 'Yes'
for i in range(len(s)):
	if s[i] in memo:
		if t[i] != memo[s[i]]:
			ans = 'No'
			break
	else:
		memo[s[i]] = t[i]
a = list(memo.values())
b = list(set(a))
if len(b) != len(a):
	ans = 'No'
print(ans)


S = input()
T = input()
for x in set(T):
	S = S.replace(S[T.index(x)], 'A').replace(x, S[T.index(x)]).replace('A', x)
if S == T:
	print('Yes')
else:
	print('No')


from collections import *
s = input()
r = input()
c = Counter(sorted(s))
C = Counter(sorted(r))
if sorted(c.values()) == sorted(C.values()):
	print('Yes')
else:
	print('No')


S = input()
T = input()
N = len(S)
d = dict()
for i in range(N):
	if S[i] not in list(d.keys()):
		if T[i] in list(d.values()):
			print('No')
			break
		d[S[i]] = T[i]
	elif d[S[i]] != T[i]:
		print('No')
		break
else:
	print('Yes')


from collections import Counter
s = list(input())
t = list(input())
cs = Counter(s)
ct = Counter(t)
csv = sorted(cs.values())
ctv = sorted(ct.values())
if csv == ctv:
	print('Yes')
	exit()
print('No')


from collections import Counter
s = list(input())
t = list(input())
sc = Counter(s)
tc = Counter(t)
sc_l = sorted(sc.values())
tc_l = sorted(tc.values())
if sc_l == tc_l:
	print('Yes')
else:
	print('No')


import collections
S = input()
T = input()
sc = sorted(collections.Counter(S).values())
tc = sorted(collections.Counter(T).values())
if sc == tc:
	print('Yes')
else:
	print('No')


from collections import Counter
print('Yes' if sorted(list(Counter(input()).values())) == sorted(list(Counter(input()).values())) else 'No')


s = input()
t = input()
ar1 = [0] * 26
ar2 = [0] * 26
for i in s:
	ar1[ord(i) - 97] += 1
for i in t:
	ar2[ord(i) - 97] += 1
ar1.sort()
ar2.sort()
if ar1 == ar2:
	print('Yes')
else:
	print('No')


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def LI():
	return list(map(int, input().split()))

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	S = input().rstrip()
	T = input().rstrip()
	L = [[S[i], T[i]] for i in range(len(S))]
	L.sort(key=lambda x: x[0])
	D = defaultdict(int)
	D2 = defaultdict(int)
	for (a, b) in L:
		if (D[a] == 0 or D[a] == b) and (D2[b] == 0 or D2[b] == a):
			D[a] = b
			D2[b] = a
		else:
			print('No')
			return
	print('Yes')

def __starting_point():
	main()
__starting_point()


from collections import Counter as C
s = list(input())
t = list(input())
print('YNeos'[C(C(s).values()) != C(C(t).values())::2])


s = list(input())
t = list(input())
s_len = len(set(s))
t_len = len(set(t))
pare = []
for (i, j) in zip(s, t):
	pare.append(i + j)
if len(set(pare)) == s_len == t_len:
	print('Yes')
else:
	print('No')


s = input()
t = input()
n = len(t)
ss = [0] * 26
tt = [0] * 26
for i in range(n):
	x = ord(s[i]) - ord('a')
	y = ord(t[i]) - ord('a')
	ss[x] += 1
	tt[y] += 1
ss.sort()
tt.sort()
if ss == tt:
	print('Yes')
else:
	print('No')


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	s = input()
	t = input()
	import string
	l = string.ascii_lowercase
	for i in l:
		trial = set()
		for (k, j) in enumerate(s):
			if i == j:
				trial.add(t[k])
				if len(trial) > 1:
					print('No')
					return
		trial = set()
		for (k, j) in enumerate(t):
			if i == j:
				trial.add(s[k])
				if len(trial) > 1:
					print('No')
					return
	print('Yes')

def __starting_point():
	main()
__starting_point()


S = input()
T = input()
trans_dict = {}
for i in range(len(S)):
	s = S[i]
	t = T[i]
	if s in trans_dict:
		if not trans_dict[s] == t:
			print('No')
			return
	else:
		trans_dict[s] = t
if len(list(trans_dict.values())) == len(set(trans_dict.values())):
	print('Yes')
else:
	print('No')


s = input()
t = input()

def f(x):
	dic = {}
	for c in x:
		if c in dic:
			dic[c] += 1
		else:
			dic[c] = 1
	return dic
d1 = f(s)
d2 = f(t)
l1 = [i for i in d1.values()]
l2 = [i for i in d2.values()]
l1.sort()
l2.sort()
if l1 == l2:
	print('Yes')
else:
	print('No')


from collections import Counter
S = list(input())
T = list(input())
cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())
if cs == ct:
	print('Yes')
else:
	print('No')


S = list(input())
T = list(input())
index_S = sorted(map(S.count, set(S)))
index_T = sorted(map(T.count, set(T)))
if index_S == index_T:
	print('Yes')
else:
	print('No')


S = input()
T = input()
dict_S = {}
dict_T = {}
for (x, y) in zip(S, T):
	if x not in dict_S:
		dict_S[x] = y
	elif dict_S[x] != y:
		print('No')
		return
	if y not in dict_T:
		dict_T[y] = x
	elif dict_T[y] != x:
		print('No')
		return
print('Yes')


S = input()
T = input()
from collections import *
cs = Counter(S)
ct = Counter(T)
csv = sorted(cs.values())
ctv = sorted(ct.values())
print('YNeos'[csv != ctv::2])


S = input()
T = input()
s_set = set(S)
t_set = set(T)
st_set = set(zip(S, T))
if len(s_set) == len(t_set) == len(st_set):
	print('Yes')
else:
	print('No')


S = input()
T = input()
chk1 = [[] for _ in range(26)]
chk2 = [[] for _ in range(26)]
for i in range(len(S)):
	s1 = ord(S[i]) - 97
	s2 = ord(T[i]) - 97
	if len(chk1[s1]) == 0:
		chk1[s1].append(T[i])
	elif chk1[s1][0] == T[i]:
		pass
	else:
		print('No')
		return
	if len(chk2[s2]) == 0:
		chk2[s2].append(S[i])
	elif chk2[s2][0] == S[i]:
		pass
	else:
		print('No')
		return
print('Yes')


from collections import defaultdict
S = input()
T = input()
dictS = defaultdict(int)
dictT = defaultdict(int)
dictS[S[0]] = dictT[T[0]] = 1
n = 2
for i in range(1, len(S)):
	if dictS[S[i]] == dictT[T[i]]:
		if dictS[S[i]] == 0:
			dictS[S[i]] = dictT[T[i]] = n
			n += 1
	else:
		print('No')
		break
else:
	print('Yes')


import collections
cntS = collections.Counter(input())
cntT = collections.Counter(input())
if sorted(cntS.values()) == sorted(cntT.values()):
	print('Yes')
else:
	print('No')


import collections as col
s = list(input())
t = list(input())
s_1 = col.Counter(s)
t_1 = col.Counter(t)
s_2 = sorted(s_1.values())
t_2 = sorted(t_1.values())
if s_2 == t_2:
	print('Yes')
else:
	print('No')


def solve():
	S = input()
	n = len(S)
	S1 = [1]
	k = 1
	for i in range(1, n):
		if S[i] not in S[:i]:
			k += 1
			S1.append(k)
		else:
			num = S1[S.find(S[i])]
			S1.append(num)
	return S1
S1 = solve()
T1 = solve()
if S1 == T1:
	print('Yes')
else:
	print('No')


s = list(input())
t = list(input())
S = []
T = []
for i in set(s):
	S.append(s.count(i))
for j in set(t):
	T.append(t.count(j))
if sorted(S) == sorted(T):
	print('Yes')
else:
	print('No')


from collections import Counter
S = input()
T = input()
cS = Counter(S).most_common()
cT = Counter(T).most_common()
for (k, j) in zip(cS, cT):
	if k[1] != j[1]:
		print('No')
		exit()
print('Yes')


s = input()
t = input()
print('Yes' if len(set(s)) == len(set(t)) == len(set(zip(s, t))) else 'No')


S = input()
T = input()
N = len(S)
chr_from = {}
chr_to = {}
flg = True
for i in range(N):
	if T[i] in chr_to:
		if S[i] not in chr_from:
			chr_to[T[i]] += 1
	else:
		chr_to[T[i]] = 1
	if S[i] in chr_from:
		if chr_from[S[i]] != T[i]:
			flg = False
	else:
		chr_from[S[i]] = T[i]
for val in chr_to.values():
	if val > 1:
		flg = False
print(['No', 'Yes'][flg])


s = input()
t = input()
import collections
cs = collections.Counter(list(s))
ct = collections.Counter(list(t))
(a, b) = (list(cs.values()), list(ct.values()))
a.sort()
b.sort()
print('Yes' if a == b else 'No')


from collections import Counter

def main():
	s = sorted(Counter(input()).values())
	t = sorted(Counter(input()).values())
	print('Yes' if t == s else 'No')
main()


import sys

def IN_I():
	return int(sys.stdin.readline().rstrip())

def IN_LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def IN_S():
	return sys.stdin.readline().rstrip()

def IN_LS():
	return list(sys.stdin.readline().rstrip().split())
S = IN_S()
T = IN_S()
d1 = dict()
d2 = dict()
len_s = len(S)
for i in range(len_s):
	a = S[i]
	b = T[i]
	if a in d1 and d1[a] != b or (b in d2 and d2[b] != a):
		print('No')
		return
	d1[a] = b
	d2[b] = a
print('Yes')


from collections import Counter
s = Counter(list(input()))
t = Counter(list(input()))
(s1, t1) = (sorted(list(s.values())), sorted(list(t.values())))
print('Yes' if s1 == t1 else 'No')


S = list(input())
T = list(input())
print('Yes' if len(set(S)) == len(set(T)) == len(set(zip(S, T))) else 'No')


(s, t) = (list(input()), list(input()))
(sd, td) = ({}, {})
for sv in s:
	if sv not in sd:
		sd[sv] = 1
	else:
		sd[sv] += 1
for tv in t:
	if tv not in td:
		td[tv] = 1
	else:
		td[tv] += 1
(ss, ts) = (sorted(sd.values()), sorted(td.values()))
if ss == ts:
	print('Yes')
else:
	print('No')


import sys
from collections import Counter, deque, defaultdict
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

def read_str():
	return sys.stdin.readline().strip()

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

def Main():
	s = read_str()
	t = read_str()
	s_lis = sorted(Counter(s).values())
	t_lis = sorted(Counter(t).values())
	if s_lis == t_lis:
		print('Yes')
	else:
		print('No')

def __starting_point():
	Main()
__starting_point()


from collections import Counter
s = [i for i in input()]
t = [i for i in input()]
ss = Counter(s)
tt = Counter(t)
if sorted(ss.values()) == sorted(tt.values()):
	print('Yes')
else:
	print('No')


S = input()
T = input()
d = {}
for (k, v) in zip(S, T):
	if d.get(k) != None and d.get(k) != v:
		print('No')
		exit()
	d[k] = v
if len(set(d.values())) == len(d):
	print('Yes')
else:
	print('No')


import collections
s = list(input())
t = list(input())
ss = collections.Counter(s)
tt = collections.Counter(t)
s_v = sorted(ss.values())
t_v = sorted(tt.values())
if s_v == t_v:
	print('Yes')
else:
	print('No')


aaa = input()
bbb = input()
d = {}
d_rev = {}
ans = 'Yes'
for (a, b) in zip(aaa, bbb):
	if a in d and d.get(a) != b or (b in d_rev and d_rev.get(b) != a):
		ans = 'No'
	d[a] = b
	d_rev[b] = a
print(ans)


from collections import defaultdict
s = input()
t = input()
dicts = defaultdict(int)
dictt = defaultdict(int)
cs = []
ct = []
for i in range(len(s)):
	dicts[s[i]] += 1
	dictt[t[i]] += 1
	cs.append(dicts[s[i]])
	ct.append(dictt[t[i]])
if cs == ct:
	print('Yes')
else:
	print('No')


S = input()
T = input()
ans = 'Yes'
(dic1, dic2) = ({}, {})
for (i, j) in zip(S, T):
	if i in dic1:
		if dic1[i] != j:
			ans = 'No'
	else:
		dic1[i] = j
	if j in dic2:
		if dic2[j] != i:
			ans = 'No'
	else:
		dic2[j] = i
print(ans)


def shurui(s):
	m = set(s)
	ans = []
	for i in m:
		ans.append(s.count(i))
	return sorted(ans)

def resolve():
	s = input()
	t = input()
	if shurui(s) == shurui(t):
		print('Yes')
	else:
		print('No')
resolve()


from collections import *
i = lambda : sorted(Counter(input()).values())
print('YNeos'[i() != i()::2])


from collections import Counter
S = Counter(list(input()))
T = Counter(list(input()))
(s, t) = (list(S.values()), list(T.values()))
print(['No', 'Yes'][sorted(s) == sorted(t)])


from collections import Counter
s = input()
t = input()
s_cnt = sorted(Counter(s).values(), reverse=True)
t_cnt = sorted(Counter(t).values(), reverse=True)
if s_cnt == t_cnt:
	print('Yes')
else:
	print('No')


from collections import Counter
s = sorted(Counter(input()).values())
t = sorted(Counter(input()).values())
for (i, j) in zip(s, t):
	if i != j:
		print('No')
		exit()
print('Yes')


import collections
S = input()
T = input()
S_c = sorted(list(collections.Counter(S).values()))
T_c = sorted(list(collections.Counter(T).values()))
print('Yes' if S_c == T_c else 'No')


from collections import Counter
S = Counter(input())
T = Counter(input())
s = sorted([v for v in S.values()])
t = sorted([v for v in T.values()])
if s == t:
	print('Yes')
else:
	print('No')


s = [0 for _ in range(26)]
t = [0 for _ in range(26)]
S = input()
T = input()
for i in range(len(S)):
	s[ord(S[i]) - ord('a')] += 1
	t[ord(T[i]) - ord('a')] += 1
s.sort()
t.sort()
print('Yes' if s == t else 'No')


S = input()
T = input()
sc = {}
tc = {}
for i in S:
	sc[i] = sc.get(i, 0) + 1
for i in T:
	tc[i] = tc.get(i, 0) + 1
x = list(sc.values())
x.sort()
y = list(tc.values())
y.sort()
if x == y:
	print('Yes')
else:
	print('No')


s = input()
t = input()
cs = []
ct = []
for i in range(97, 97 + 26):
	cs.append(s.count(chr(i)))
	ct.append(t.count(chr(i)))
if sorted(cs) == sorted(ct):
	print('Yes')
else:
	print('No')


s = input()
t = input()
ss = [s.find(i) for i in s]
tt = [t.find(i) for i in t]
if ss == tt:
	print('Yes')
else:
	print('No')


S = input()
T = input()
C_S = [None for _ in range(26)]
C_T = [None for _ in range(26)]
ok = True
for i in range(len(S)):
	if not C_S[ord(S[i]) - ord('a')]:
		C_S[ord(S[i]) - ord('a')] = T[i]
	elif C_S[ord(S[i]) - ord('a')] != T[i]:
		ok = False
		break
	if not C_T[ord(T[i]) - ord('a')]:
		C_T[ord(T[i]) - ord('a')] = S[i]
	elif C_T[ord(T[i]) - ord('a')] != S[i]:
		ok = False
		break
if ok:
	print('Yes')
else:
	print('No')


S = input()
T = input()
Ls = [0] * 26
Lt = [0] * 26
for s in S:
	Ls[ord(s) - 97] += 1
for t in T:
	Lt[ord(t) - 97] += 1
Ls.sort()
Lt.sort()
if Ls == Lt:
	print('Yes')
else:
	print('No')


s = input()
t = input()
(x, y, f) = ([-1] * 26, [-1] * 26, 1)
for i in range(len(s)):
	if x[ord(s[i]) - 97] != y[ord(t[i]) - 97]:
		f = 0
	else:
		(x[ord(s[i]) - 97], y[ord(t[i]) - 97]) = (i, i)
if f:
	print('Yes')
else:
	print('No')


S = input()
T = input()
d = {}
for (s, t) in zip(S, T):
	if s in d:
		if d[s] != t:
			print('No')
			exit()
	else:
		d[s] = t
if len(d) != len(set(d.values())):
	print('No')
else:
	print('Yes')


s = input()
t = input()
s_c = []
t_c = []
for c in 'abcdefghijklmnopqrstuvwxyz':
	s_c.append(s.count(c))
	t_c.append(t.count(c))
s_c.sort()
t_c.sort()
if s_c == t_c:
	print('Yes')
else:
	print('No')


s = list(input())
t = list(input())
n = len(s)
ch = 0
ch1 = 0
ans = 0
d = {}
d1 = {}
st = 1
st1 = 1
s_new = []
t_new = []
for i in range(n):
	if s[i] not in d:
		d[s[i]] = st
		st += 1
for g in range(n):
	if t[g] not in d1:
		d1[t[g]] = st1
		st1 += 1
for h in range(n):
	s_new.append(d[s[h]])
	t_new.append(d1[t[h]])
if s_new == t_new:
	print('Yes')
else:
	print('No')


from collections import Counter

def f(V):
	V = sorted(list(map(str, Counter(V).values())))
	return ''.join(V)
S = input()
T = input()
ans = 'Yes' if f(S) == f(T) else 'No'
print(ans)


def solve(S, T):
	N = len(S)
	S_check = [0] * N
	T_check = [0] * N
	for i in range(N):
		if S_check[i] == 0:
			S_check[i] = 1
			for j in range(i + 1, N):
				if S[i] == S[j]:
					S_check[j] = 1
					if T[i] != T[j]:
						print('No')
						return
		if T_check[i] == 0:
			T_check[i] = 1
			for j in range(i + 1, N):
				if T[i] == T[j]:
					T_check[j] = 1
					if S[i] != S[j]:
						print('No')
						return
	print('Yes')

def __starting_point():
	S = input()
	T = input()
	solve(S, T)
__starting_point()


from collections import *
c = Counter
f = lambda : c(c(input()).values())
print('YNeos'[f() != f()::2])


s = input()
t = input()
a = {}
b = {}
for (c, d) in zip(s, t):
	if a.setdefault(c, d) != d:
		print('No')
		break
	if b.setdefault(d, c) != c:
		print('No')
		break
else:
	print('Yes')


alp = 'abcdefghijklmnopqrstuvwxyz'
s = input()
t = input()
l = len(s)
a = []
b = []
for i in alp:
	a.append(s.count(i))
	b.append(t.count(i))
a.sort()
b.sort()
if a == b:
	print('Yes')
else:
	print('No')


from collections import Counter
print('NYoe s'[sorted(list(Counter(input()).values())) == sorted(list(Counter(input()).values()))::2])


from collections import Counter
s = input()
t = input()
cnt_s = Counter(s)
cnt_t = Counter(t)
for i in range(len(s)):
	if cnt_s[s[i]] != cnt_t[t[i]]:
		print('No')
		exit()
print('Yes')


a = input()
b = input()
A = a
s = set()
for i in range(len(a)):
	if b[i] not in s:
		A = A.replace(A[i], b[i].upper())
	s |= {b[i]}
if A == b.upper():
	print('Yes')
else:
	print('No')


from collections import Counter
S = input()
T = input()
s = list(Counter(S).values())
t = list(Counter(T).values())
s.sort()
t.sort()
if len(s) != len(t) or s != t:
	print('No')
else:
	print('Yes')


S = input()
T = input()
S_cnt = sorted((S.count(c) for c in set(S)))
T_cnt = sorted((T.count(c) for c in set(T)))
print('Yes') if S_cnt == T_cnt else print('No')


from collections import Counter as C
s = C(input()).most_common()
t = C(input()).most_common()
print('Yes' if [s[i][1] for i in range(len(s))] == [t[i][1] for i in range(len(t))] else 'No')


(S, T) = (input(), input())
d = [None] * 26
flag = True
for (s, t) in zip(S, T):
	s = ord(s) - ord('a')
	t = ord(t) - ord('a')
	if d[s] is None:
		d[s] = t
	elif d[s] != t:
		flag = False
		break
if not flag:
	print('No')
elif len(set((v for v in d if v is not None))) != sum((int(v is not None) for v in d)):
	print('No')
else:
	print('Yes')


S = input()
T = input()
l = len(S)
Rs = [0] * 26
Rt = [0] * 26
for i in range(l):
	Rs[ord(S[i]) - ord('a')] += 1
	Rt[ord(T[i]) - ord('a')] += 1
Rs.sort()
Rt.sort()
if Rs == Rt:
	print('Yes')
else:
	print('No')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def solve(S, T):
	d = dict()
	for (s, t) in zip(S, T):
		if s in d and d[s] != t:
			return False
		else:
			d[s] = t
	return True

def main():
	S = readline().strip()
	T = readline().strip()
	if solve(S, T) and solve(T, S):
		print('Yes')
	else:
		print('No')
	return

def __starting_point():
	main()
__starting_point()


from collections import Counter
s = input()
t = input()
c1 = list(Counter(s).values())
c2 = list(Counter(t).values())
c1.sort()
c2.sort()
print('Yes' if c1 == c2 else 'No')


from collections import Counter
s = Counter(list(input()))
t = Counter(list(input()))
s_s = sorted(s.values())
t_s = sorted(t.values())
if s_s == t_s:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
sc = Counter(s)
tc = Counter(t)
sn = [x for x in sc.values()]
tn = [x for x in tc.values()]
sn.sort()
tn.sort()
print('Yes') if sn == tn else print('No')


S = input()
T = input()
length = len(S)
keep_S = [[] for i in range(26)]
keep_T = [[] for i in range(26)]
for i in range(length):
	num_S = ord(T[i]) - ord('a')
	num_T = ord(S[i]) - ord('a')
	if S[i] in keep_S[num_S]:
		continue
	else:
		keep_S[num_S].append(S[i])
	if T[i] in keep_T[num_T]:
		continue
	else:
		keep_T[num_T].append(T[i])
for i in range(26):
	if (len(keep_T[i]) > 1) | (len(keep_S[i]) > 1):
		print('No')
		return
print('Yes')


S = input()
T = input()
s = [[] for i in range(26)]
t = [[] for i in range(26)]
for i in range(len(S)):
	s[ord(S[i]) - 97].append(i)
	t[ord(T[i]) - 97].append(i)
s = sorted(s)
t = sorted(t)
if s == t:
	print('Yes')
else:
	print('No')


(s, t) = (input(), input())
print('Yes' if [t.find(t_i) for t_i in t] == [s.find(s_i) for s_i in s] else 'No')


from collections import Counter
s = input()
t = input()
a = Counter(s)
b = Counter(t)
c = list(a.values())
d = list(b.values())
print('Yes') if c == d else print('No')


import numpy as np
S = np.array(list(input()))
T = np.array(list(input()))
N = len(S)
SSrt = np.sort(S)
TSrt = np.sort(T)
SArg = np.argsort(S)
TArg = np.argsort(T)
SAgT = S[TArg]
TAgS = T[SArg]
SBef = ''
TBef = ''
SFlag = True
for ST in range(0, N):
	SNow = SSrt[ST]
	TNow = TAgS[ST]
	if SBef == SNow:
		if TBef != TNow:
			SFlag = False
			break
	SBef = SNow
	TBef = TNow
SBef = ''
TBef = ''
TFlag = True
for TT in range(0, N):
	SNow = SAgT[TT]
	TNow = TSrt[TT]
	if TBef == TNow:
		if SBef != SNow:
			TFlag = False
			break
	SBef = SNow
	TBef = TNow
if SFlag and TFlag:
	print('Yes')
else:
	print('No')


s = input()
t = input()
listA = [s.count(chr(i)) for i in range(ord('a'), ord('z') + 1)]
listB = [t.count(chr(i)) for i in range(ord('a'), ord('z') + 1)]
listA.sort()
listB.sort()
print('Yes' if listA == listB else 'No')


S = input()
T = input()
N = len(S)
d1 = {}
d2 = {}
for i in range(N):
	if S[i] not in d1:
		d1[S[i]] = T[i]
	elif d1[S[i]] != T[i]:
		print('No')
		return
	else:
		pass
	if T[i] not in d2:
		d2[T[i]] = S[i]
	elif d2[T[i]] != S[i]:
		print('No')
		return
	else:
		pass
print('Yes')


import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
	print('Yes')
else:
	print('No')


from collections import *
f = lambda : sorted(Counter(input()).values())
print('YNeos'[f() != f()::2])


from collections import Counter
s = [i for i in str(input())]
t = [h for h in str(input())]
s1 = Counter(s).most_common()
t1 = Counter(t).most_common()
if len(s1) != len(t1):
	print('No')
else:
	z = 'Yes'
	for j in range(len(s1)):
		if s1[j][1] != t1[j][1]:
			z = 'No'
			break
	print(z)


s = list(input())
t = list(input())
cnt1 = [[] for _ in range(26)]
cnt2 = [[] for _ in range(26)]
for i in range(len(s)):
	num1 = ord(s[i]) - 97
	num2 = ord(t[i]) - 97
	if t[i] not in cnt1[num1]:
		cnt1[num1].append(t[i])
	if s[i] not in cnt2[num2]:
		cnt2[num2].append(s[i])
ans = 0
for i in range(26):
	if len(cnt1[i]) > 1:
		ans = 1
		break
	if len(cnt2[i]) > 1:
		ans = 1
		break
if ans == 0:
	print('Yes')
else:
	print('No')


from collections import Counter
s = input()
t = input()
s_dict = Counter(s)
t_dict = Counter(t)
s_val = list(s_dict.values())
t_val = list(t_dict.values())
s_val.sort()
t_val.sort()
if s_val == t_val:
	print('Yes')
else:
	print('No')


import sys
import math
from collections import defaultdict
from collections import deque
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda : sys.stdin.readline().strip()
NI = lambda : int(input())
NMI = lambda : map(int, input().split())
NLI = lambda : list(NMI())
SI = lambda : input()

def main():
	S = SI()
	T = SI()
	D = defaultdict(str)
	for (s, t) in zip(S, T):
		if D[s] == '':
			D[s] = t
		if D[s] != t:
			print('No')
			return
	if len(set(D.keys())) != len(set(D.values())):
		print('No')
	else:
		print('Yes')

def __starting_point():
	main()
__starting_point()


from collections import Counter
(S, T) = (Counter([s for s in input()]), Counter([s for s in input()]))
print('Yes' if Counter(S.values()) == Counter(T.values()) else 'No')


s = input()
t = input()
cycle_to = [''] * 26
cycle_from = [''] * 26
for i in range(len(s)):
	if cycle_to[ord(s[i]) - 97] == t[i]:
		continue
	if cycle_to[ord(s[i]) - 97] == '':
		cycle_to[ord(s[i]) - 97] = t[i]
	else:
		print('No')
		break
	if cycle_from[ord(t[i]) - 97] == s[i]:
		continue
	if cycle_from[ord(t[i]) - 97] == '':
		cycle_from[ord(t[i]) - 97] = s[i]
	else:
		print('No')
		break
else:
	print('Yes')