Chef usually likes to play cricket, but now, he is bored of playing it too much, so he is trying new games with strings. Chef's friend Dustin gave him binary strings $S$ and $R$, each with length $N$, and told him to make them identical. However, unlike Dustin, Chef does not have any superpower and Dustin lets Chef perform only operations of one type: choose any pair of integers $(i, j)$ such that $1 \le i, j \le N$ and swap the $i$-th and $j$-th character of $S$. He may perform any number of operations (including zero).
For Chef, this is much harder than cricket and he is asking for your help. Tell him whether it is possible to change the string $S$ to the target string $R$ only using operations of the given type.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains a binary string $S$.
- The third line contains a binary string $R$.

-----Output-----
For each test case, print a single line containing the string "YES" if it is possible to change $S$ to $R$ or "NO" if it is impossible (without quotes).

-----Constraints-----
- $1 \le T \le 400$
- $1 \le N \le 100$
- $|S| = |R| = N$
- $S$ and $R$ will consist of only '1' and '0'

-----Example Input-----
2
5
11000
01001
3
110
001

-----Example Output-----
YES
NO

-----Explanation-----
Example case 1: Chef can perform one operation with $(i, j) = (1, 5)$. Then, $S$ will be "01001", which is equal to $R$.
Example case 2: There is no sequence of operations which would make $S$ equal to $R$.

Difficulty: EASY
Tags: Data structures
Skill types: Data structures

Starter code:

Solutions:
for i in range(int(input())):
	a = int(input())
	b = input()
	c = input()
	d = b.count('0')
	e = c.count('0')
	if d == e:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = input()
	b = input()
	if a.count('1') == b.count('1'):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = input()
	c0 = 0
	c1 = 0
	d0 = 0
	d1 = 0
	for i in s:
		if i == '1':
			c1 = c1 + 1
		else:
			c0 = c0 + 1
	for i in r:
		if i == '1':
			d1 = d1 + 1
		else:
			d0 = d0 + 1
	if c0 == d0 and c1 == d1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	r = str(input())
	l = list(s)
	m = list(r)
	count1 = l.count('1')
	count2 = l.count('0')
	count3 = m.count('1')
	count4 = m.count('0')
	if count1 == count3 and count2 == count4:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	x = input()
	y = input()
	if x.count('1') == y.count('1'):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	cs1 = 0
	cs0 = 0
	cr1 = 0
	cr0 = 0
	for i in s:
		if i == '0':
			cs0 += 1
		else:
			cs1 += 1
	for i in r:
		if i == '0':
			cr0 += 1
		else:
			cr1 += 1
	if cs1 == cr1 and cs0 == cr0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ar = input()
	br = input()
	(a, b, c, d) = (0, 0, 0, 0)
	for i in ar:
		if i == '0':
			a += 1
		else:
			b += 1
	for j in br:
		if j == '0':
			c += 1
		else:
			d += 1
	if a == c and b == d:
		print('YES')
	else:
		print('NO')


import math
for t in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	s1 = sorted(s)
	r1 = sorted(r)
	if s1 == r1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	b = input()
	if a.count('1') == b.count('1') and a.count('0') == b.count('0'):
		print('YES')
	else:
		print('NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = Counter(input())
	r = Counter(input())
	if s == r:
		print('YES')
	else:
		print('NO')


def oz(s: str):
	o = 0
	z = 0
	for i in s:
		if i == '1':
			o = o + 1
		else:
			z = z + 1
	return (o, z)
n = int(input())
for i in range(n):
	N = int(input())
	s = input()
	r = input()
	if oz(s) == oz(r):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	count0 = 0
	count1 = 1
	if s.count('1') == r.count('1') and s.count('0') == r.count('0'):
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	x = str(input())
	r = str(input())
	if x.count('1') == r.count('1'):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s1 = input()
	s2 = input()
	if s1.count('1') == s2.count('1') and s1.count('0') == s2.count('0'):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	x = s.count('1')
	y = r.count('1')
	if x == y:
		print('YES')
	else:
		print('NO')


rii = lambda : map(int, input().strip().split(' '))
ril = lambda : list(map(int, input().strip().split(' ')))
ri = lambda : int(input().strip())
rs = lambda : input()
T = ri()
for _ in range(T):
	N = ri()
	l1 = rs()
	l2 = rs()
	nb1_1 = len(list(filter(lambda x: x == '1', l1)))
	nb2_1 = len(list(filter(lambda x: x == '1', l2)))
	if nb1_1 == nb2_1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = int(input())
	r = int(input())
	s = str(s)
	r = str(r)
	slist = list(map(int, s.strip()))
	rlist = list(map(int, r.strip()))
	if sum(slist) == sum(rlist):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = input()
	if s.count('0') != r.count('0') or s.count('1') != r.count('1'):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	a = s.count('0')
	b = s.count('1')
	c = r.count('0')
	d = r.count('1')
	if a == c and b == d:
		print('YES')
	else:
		print('NO')


def cricketbetterthana(s, b):
	if s.count('1') != b.count('1'):
		return False
	return True
for _ in range(int(input())):
	n = int(input())
	s = list(input())
	b = list(input())
	if cricketbetterthana(s, b):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = input()
	s1 = 0
	r1 = 0
	for i in range(n):
		if r[i] == '1':
			r1 += 1
		if s[i] == '1':
			s1 += 1
	if s1 == r1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	length = int(input())
	S = input()
	R = input()
	if S.count('1') == R.count('1'):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	s1 = s.count('0')
	s2 = s.count('1')
	r1 = r.count('0')
	r2 = r.count('1')
	if s1 == r1 and s2 == r2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	l = input()
	l1 = input()
	c = 0
	c1 = 0
	for i in l:
		if i == '1':
			c = c + 1
	for j in l1:
		if j == '1':
			c1 = c1 + 1
	if c == c1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s1 = list(input())
	s2 = list(input())
	s1.sort()
	s2.sort()
	if s1 == s2:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s1 = input()
	s2 = input()
	k1 = s1.count('0')
	k2 = s1.count('1')
	k3 = s2.count('0')
	k4 = s2.count('1')
	if k1 == k3 and k4 == k2:
		print('YES')
	else:
		print('NO')


from collections import Counter

def test():
	n = int(input())
	s = input()
	r = input()
	ones = s.count('1')
	zeros = s.count('0')
	oner = r.count('1')
	zeror = r.count('0')
	if ones == oner and zeror == zeros:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	test()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = input()
	c1 = 0
	c2 = 0
	for j in range(n):
		if s[j] == '1':
			c1 += 1
		if r[j] == '1':
			c2 += 1
	if c1 == c2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	if s.count('0') == r.count('0') and s.count('1') == r.count('1'):
		print('YES')
	else:
		print('NO')


from collections import Counter as cr
for _ in range(int(input())):
	t = int(input())
	s = cr(input())
	p = cr(input())
	print('YES' if s == p else 'NO')


s = int(input())
for i in range(s):
	a = int(input())
	n = input()
	m = input()
	count1 = 0
	count0 = 0
	count2_1 = 0
	count2_0 = 0
	for j in range(a):
		if n[j] == '1':
			count1 += 1
		if n[j] == '0':
			count0 += 1
		if m[j] == '1':
			count2_1 += 1
		if m[j] == '0':
			count2_0 += 1
	if count0 == count2_0 and count1 == count2_1:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	a = input()
	b = input()
	if a.count('0') == b.count('0'):
		print('YES')
	else:
		print('NO')


def count(s, d):
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
for i in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	d = {}
	d1 = {}
	count(s, d)
	count(r, d1)
	if d == d1:
		print('YES')
	else:
		print('NO')


n = int(input())
i = 0
while i < n:
	x = int(input())
	(a, b) = (input(), input())
	if a.count('1') == b.count('1') and a.count('0') == b.count('0'):
		print('YES')
	else:
		print('NO')
	i += 1


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	c = 0
	c1 = 0
	for j in s:
		if j == '1':
			c += 1
	for k in r:
		if k == '1':
			c1 += 1
	if c == c1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input()))
	b = list(map(int, input()))
	c = a.count(0)
	d = a.count(1)
	e = b.count(0)
	f = b.count(1)
	if c == e and d == f:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = list(input())
	b = list(input())
	s = []
	if len(a) == len(b):
		for i in range(0, len(a)):
			for j in range(0, len(b)):
				if a[i] == b[j]:
					b.remove(b[j])
					s.append(a[i])
					break
				else:
					pass
		if len(a) == len(s):
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = input()
	l1 = list(s)
	l2 = list(r)
	l1.sort()
	l2.sort()
	if l1 == l2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s1 = input()
	s2 = input()
	s11 = sorted(s1)
	s22 = sorted(s2)
	if s11 == s22:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = int(input())
	s = input()
	r = input()
	c1 = 0
	c2 = 0
	c3 = 0
	c4 = 0
	for i in range(l):
		if s[i] == '0':
			c1 += 1
		else:
			c2 += 1
	for j in range(l):
		if r[j] == '0':
			c3 += 1
		else:
			c4 += 1
	if c1 == c3 and c2 == c4:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = int(input())
	b = input()
	c = input()
	if b.count('1') == c.count('1') and b.count('0') == c.count('0'):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	if s.count('1') == r.count('1'):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	m = int(input())
	s = input()[:m]
	j = input()[:m]
	(a, b) = (0, 0)
	for i in range(m):
		if s[i] == '1':
			a += 1
		if j[i] == '1':
			b += 1
	if a == b:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = int(input())
	b = input()
	c = input()
	if b.count('1') == c.count('1'):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	w = int(input())
	r1 = input()
	r2 = input()
	if r1.count('1') == r2.count('1') and r1.count('0') == r2.count('0'):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	t = list(input())
	j = list(input())
	if t.count('1') == j.count('1'):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	r = input()
	s = input()
	k = s.count('0')
	p = s.count('1')
	m = r.count('0')
	o = r.count('1')
	if k == m and p == o:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	b = input()
	c = 0
	d = 0
	for j in range(0, n):
		if a[j] == '1':
			c = c + 1
		if b[j] == '1':
			d = d + 1
	if c == d:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = input()
	s = str(s)
	r = str(r)
	sc = 0
	rc = 0
	for i in range(len(s)):
		if s[i] == '1':
			sc += 1
		else:
			pass
		if r[i] == '1':
			rc += 1
		else:
			pass
	if sc == rc:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	n = int(input())
	S = input()
	R = input()
	l = [x for x in S]
	m = [x for x in R]
	if l.count('0') == m.count('0') or l.count('1') == m.count('1'):
		print('YES')
	else:
		print('NO')


def func(p):
	l = []
	for i in p:
		l.append(int(i))
	return l.count(1)
t = int(input())
for i in range(0, t):
	n = int(input())
	s = func(input())
	r = func(input())
	if s == r:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	n1 = int(input())
	l = input()
	l1 = input()
	if l.count('1') == l1.count('1') and l.count('0') == l1.count('0'):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	fr = list(input())
	gr = list(input())
	fr.sort()
	gr.sort()
	if fr == gr:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	n1 = input()
	n2 = input()
	if n1.count('0') == n2.count('0'):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	r = input()
	if s.count('0') == r.count('0') and s.count('1') == r.count('1'):
		print('YES')
	else:
		print('NO')
	t = t - 1


for _ in range(int(input())):
	N = int(input())
	S = input()
	R = input()
	if S.count('0') == R.count('0'):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	N = int(input())
	s = input()
	k = input()
	c = 0
	c1 = 0
	for i in s:
		if i == '0':
			c += 1
	for j in k:
		if j == '0':
			c1 += 1
	if c == c1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = sorted(input())
	r = sorted(input())
	if s == r:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	str1 = input()
	str2 = input()
	count1 = 0
	count2 = 0
	lst1 = list(str1)
	lst2 = list(str2)
	for i in range(n):
		if lst1[i] == '1':
			count1 += 1
	for k in range(n):
		if lst2[k] == '1':
			count2 += 1
	if count1 == count2:
		print('YES')
	else:
		print('NO')


for _____cases_____ in range(int(input())):
	(N, S, R) = (int(input()), input(), input())
	print('YES') if S.count('1') == R.count('1') and S.count('0') == R.count('0') else print('NO')