You are given two strings $s$ and $t$ both of length $n$ and both consisting of lowercase Latin letters.

In one move, you can choose any length $len$ from $1$ to $n$ and perform the following operation:   Choose any contiguous substring of the string $s$ of length $len$ and reverse it;  at the same time choose any contiguous substring of the string $t$ of length $len$ and reverse it as well. 

Note that during one move you reverse exactly one substring of the string $s$ and exactly one substring of the string $t$.

Also note that borders of substrings you reverse in $s$ and in $t$ can be different, the only restriction is that you reverse the substrings of equal length. For example, if $len=3$ and $n=5$, you can reverse $s[1 \dots 3]$ and $t[3 \dots 5]$, $s[2 \dots 4]$ and $t[2 \dots 4]$, but not $s[1 \dots 3]$ and $t[1 \dots 2]$.

Your task is to say if it is possible to make strings $s$ and $t$ equal after some (possibly, empty) sequence of moves.

You have to answer $q$ independent test cases.


-----Input-----

The first line of the input contains one integer $q$ ($1 \le q \le 10^4$) — the number of test cases. Then $q$ test cases follow.

The first line of the test case contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the length of $s$ and $t$.

The second line of the test case contains one string $s$ consisting of $n$ lowercase Latin letters.

The third line of the test case contains one string $t$ consisting of $n$ lowercase Latin letters.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$ ($\sum n \le 2 \cdot 10^5$).


-----Output-----

For each test case, print the answer on it — "YES" (without quotes) if it is possible to make strings $s$ and $t$ equal after some (possibly, empty) sequence of moves and "NO" otherwise.


-----Example-----
Input
4
4
abcd
abdc
5
ababa
baaba
4
asdf
asdg
4
abcd
badc

Output
NO
YES
NO
YES

Difficulty: introductory

Starter code:

Solutions:
q = int(input())
for _ in range(q) :
  n = int(input())
  s = input()
  t = input()

  x = set(s)
  y = set(t)

  if x != y :
    print("NO")
    continue

  if len(x) == n :
    a = [0] * n
    for i, c in enumerate(t) :
      a[i] = s.find(c)

    yeet = 0
    vis = [False] * n
    for i in range(n) :
      if vis[i] :
        continue
      j = i
      cyc = 0
      while not vis[j] :
        cyc += 1
        vis[j] = True
        j = a[j]
      # print('>> ', i, cyc)
      yeet += (cyc - 1) % 2
      yeet %= 2

    if yeet == 0 :
      print("YES")
    else :
      print("NO")
    continue

  print("YES")


from operator import itemgetter


class BIT():
    def __init__(self, n):
        '''n = 要素数
        要素の添字iは 0 <= i < n となる
        '''
        self.n = n
        self.bit = [0] * (n + 1)
 
    def add(self, i, val):
        '''i番目の要素にvalを加算する O(logN)'''
        i = i + 1
        while i <= self.n:
            self.bit[i] += val
            i += i & -i
 
    def _sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s
 
    def sum(self, i, j):
        '''区間[i, j)の和を求める O(logN)'''
        return self._sum(j) - self._sum(i)


def run_length_compress(string):
    string.append("@")
    n = len(string)

    begin = 0
    end = 1
    cnt = 1
    ans = []
    while True:
        if end >= n:
            break
        if string[begin] == string[end]:
            end += 1
            cnt += 1
        else:
            ans.append((cnt, string[begin]))
            begin = end
            end = begin + 1
            cnt = 1

    return ans


q = int(input())
for _ in range(q):
    n = int(input())
    s = list(input())
    t = list(input())
    tmp_s = sorted(s)
    tmp_t = sorted(t)
    s_run = run_length_compress(tmp_s)
    t_run = run_length_compress(tmp_t)
    flag = False
    f = False
    for i in range(len(s_run)):
        if s_run[i][0] >= 2:
            flag = True
        if s_run[i] != t_run[i]:
            print("NO")
            f = True
            break
    if f:
        continue
    if flag:
        print("YES")
        continue
    cnt_s = 0
    cnt_t = 0
    for i in range(n)[::-1]:
        for j in range(i):
            if s[j] > s[j+1]:
                s[j], s[j+1] = s[j+1], s[j]
                cnt_s += 1
            if t[j] > t[j+1]:
                t[j], t[j+1] = t[j+1], t[j]
                cnt_t += 1
    if cnt_s % 2 == cnt_t % 2:
        print("YES")
    else:
        print("NO")


import sys
input = sys.stdin.readline

q=int(input())

from collections import Counter

for testcases in range(q):
    n=int(input())
    S=input().strip()
    T=input().strip()

    CS=Counter(S)
    CT=Counter(T)

    if CS!=CT:
        print("NO")
        continue

    if max(CS.values())>=2:
        print("YES")
        continue

    W=[0]*26
    SA=0

    for s in S:
        SA+=sum(W[ord(s)-97:])
        W[ord(s)-97]+=1

    #print(SA)

    W=[0]*26
    TA=0

    for s in T:
        TA+=sum(W[ord(s)-97:])
        W[ord(s)-97]+=1

    #print(TA)

    if (SA+TA)%2==0:
        print("YES")
    else:
        print("NO")

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


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


q = int(input())
for _ in range(q):
    n = int(input())
    s = input()
    t = input()
    if Counter(s) != Counter(t):
        print('NO')
        continue
    elif Counter(s).most_common()[0][1] > 1:
        print('YES')
        continue
    s_list = [ord(s[i]) for i in range(n)]
    t_list = [ord(t[i]) for i in range(n)]

    bit_s = Bit(150)
    inv_s = 0
    for i in range(n-1, -1, -1):
        inv_s += bit_s.sum(s_list[i])
        bit_s.add(s_list[i], 1)

    bit_t = Bit(150)
    inv_t = 0
    for i in range(n - 1, -1, -1):
        inv_t += bit_t.sum(t_list[i])
        bit_t.add(t_list[i], 1)

    if (inv_s - inv_t) % 2 == 0:
        print('YES')
    else:
        print('NO')


import sys

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

def mint():
	return int(minp())

def mints():
	return list(map(int,minp().split()))

def solve():
	n = mint()

	s = list(minp())
	t = list(minp())
	if sorted(t) != sorted(s):
		print("NO")
		return

	for i in range(26):
		if s.count(chr(ord('a')+i)) > 1:
			print("YES")
			return
	r = 0
	for i in range(len(s)):
		for j in range(i+1,len(s)):
			if t.index(s[i]) > t.index(s[j]):
				r += 1
	#print(r)
	print(["NO","YES"][r%2 == 0])

for i in range(mint()):
	solve()


import sys

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

def mint():
	return int(minp())

def mints():
	return list(map(int,minp().split()))

def solve():
	n = mint()

	s = list(minp())
	t = list(minp())
	if sorted(t) != sorted(s):
		print("NO")
		return

	for i in range(26):
		if s.count(chr(ord('a')+i)) > 1:
			print("YES")
			return
	r = 0
	for i in range(len(s)):
		for j in range(i+1,len(s)):
			if t.index(s[i]) > t.index(s[j]):
				r += 1
	#print(r)
	print(["NO","YES"][r%2 == 0])

for i in range(mint()):
	solve()


from collections import *
def f(s):
    c = Counter(s)
    if c.most_common()[0][1]>1:
        return c
    return c,sum(s[i]>s[j] for i in range(len(s))for j in range(i,len(s)))&1
for _ in range(int(input())):
    n,s,t=input(),input(),input()
    print("YNEOS"[f(s)!=f(t)::2])

from collections import *
f=lambda s:(Counter(s),len(set(s))==len(s)and sum(s[i]>s[j] for i in range(len(s))for j in range(i,len(s)))&1)
for _ in range(int(input())):
    n,s,t=input(),input(),input()
    print("YNEOS"[f(s)!=f(t)::2])

q = int(input())
for i in range(q):
    n = int(input())
    a = input()
    b = input()
    countA = [0]*26
    countB = [0]*26
    for char in a:
        countA[ord(char)-97] += 1
    for char in b:
        countB[ord(char)-97] += 1
    no = 0
    for i in range(26):
        if countA[i] != countB[i]:
            no = 1
            break
    if no:
        print("NO")
        continue
    yes = 0
    for i in range(26):
        if countA[i] >= 2:
            yes = 1
            break
        if countB[i] >= 2:
            yes = 1
            break
    if yes:
        print("YES")
        continue
    def countRev(s):
        count = 0
        for i in range(n):
            for j in range(i+1,n):
                if s[i] > s[j]:
                    count += 1
        return count
    x = countRev(a) - countRev(b)
    if x%2:
        print("NO")
    else:
        print("YES")

from collections import Counter 
for _ in range(int(input())):
    n=int(input())
    s=input()
    t=input()
    c1=Counter(s)
    c2=Counter(t)
    if  c1!=c2:
        print('NO')
        continue 
    if n>26:
        print('YES')
        continue 
    if max(c1.values())>=2:
        print("YES")
        continue
    p1=0 
    p2=0 
    for i in range(n):
        for j in range(i+1,n):
            if s[i]>s[j]:
                p1+=1 
            if t[i]>t[j]:
                p2+=1 
    print('YES' if p1%2==p2%2 else "NO")

def cal(s):
    res = 0
    for i in range(len(s)):
        for j in range(i+1,len(s)):
            if s[i]>s[j]:
                res ^= 1
    return res

def solve():
    int(input())
    s = input()
    t = input()
    if(sorted(s)!=sorted(t)):
        print('NO')
        return
    for i in range(26):
        if s.count(chr(ord('a')+i))>1:
            print('YES')
            return
    print(['NO','YES'][cal(s)==cal(t)])

for i in range(int(input())):
    solve()


def cal(s):
    res = 0
    for i in range(len(s)):
        for j in range(i+1,len(s)):
            if s[i]>s[j]:
                res ^= 1
    return res

def solve():
    [n,s,t] = [input(),input(),input()]
    if(sorted(s)!=sorted(t)):
        print('NO')
        return
    for i in range(26):
        if s.count(chr(ord('a')+i))>1:
            print('YES')
            return
    print(['NO','YES'][cal(s)==cal(t)])

for i in range(int(input())):
    solve()


q = int(input())

# Python 3 program to count inversions in an array 

# Function to Use Inversion Count 
def mergeSort(arr, n): 
	# A temp_arr is created to store 
	# sorted array in merge function 
	temp_arr = [0]*n 
	return _mergeSort(arr, temp_arr, 0, n-1) 

# This Function will use MergeSort to count inversions 

def _mergeSort(arr, temp_arr, left, right): 

	# A variable inv_count is used to store 
	# inversion counts in each recursive call 

	inv_count = 0

	# We will make a recursive call if and only if 
	# we have more than one elements 

	if left < right: 

		# mid is calculated to divide the array into two subarrays 
		# Floor division is must in case of python 

		mid = (left + right)//2

		# It will calculate inversion counts in the left subarray 

		inv_count = _mergeSort(arr, temp_arr, left, mid) 

		# It will calculate inversion counts in right subarray 

		inv_count += _mergeSort(arr, temp_arr, mid + 1, right) 

		# It will merge two subarrays in a sorted subarray 

		inv_count += merge(arr, temp_arr, left, mid, right) 
	return inv_count 

# This function will merge two subarrays in a single sorted subarray 
def merge(arr, temp_arr, left, mid, right): 
	i = left	 # Starting index of left subarray 
	j = mid + 1 # Starting index of right subarray 
	k = left	 # Starting index of to be sorted subarray 
	inv_count = 0

	# Conditions are checked to make sure that i and j don't exceed their 
	# subarray limits. 

	while i <= mid and j <= right: 

		# There will be no inversion if arr[i] <= arr[j] 

		if arr[i] <= arr[j]: 
			temp_arr[k] = arr[i] 
			k += 1
			i += 1
		else: 
			# Inversion will occur. 
			temp_arr[k] = arr[j] 
			inv_count += (mid-i + 1) 
			k += 1
			j += 1

	# Copy the remaining elements of left subarray into temporary array 
	while i <= mid: 
		temp_arr[k] = arr[i] 
		k += 1
		i += 1

	# Copy the remaining elements of right subarray into temporary array 
	while j <= right: 
		temp_arr[k] = arr[j] 
		k += 1
		j += 1

	# Copy the sorted subarray into Original array 
	for loop_var in range(left, right + 1): 
		arr[loop_var] = temp_arr[loop_var] 
		
	return inv_count 


for i in range(q):
    l = int(input())
    s1 = input()
    s2 = input()

    if sorted(s1) != sorted(s2):
        print("NO")
        continue

    if len(s1) != len(set(s1)): print("YES"); continue
    if len(s2) != len(set(s2)): print("YES"); continue

    arr = [s2.index(c) for c in s1]
    
    
    if mergeSort(arr, len(arr)) % 2 == 0:
        print("YES")
    else:
        print("NO")
    


import sys
 
def minp():
	return sys.stdin.readline().strip()
 
def mint():
	return int(minp())
 
def mints():
	return list(map(int,minp().split()))
 
def solve():
	n = mint()
 
	s = list(minp())
	t = list(minp())
	if sorted(t) != sorted(s):
		print("NO")
		return
 
	for i in range(26):
		if s.count(chr(ord('a')+i)) > 1:
			print("YES")
			return
	r = 0
	for i in range(len(s)):
		for j in range(i+1,len(s)):
			if t.index(s[i]) > t.index(s[j]):
				r += 1
	#print(r)
	print(["NO","YES"][r%2 == 0])
 
for i in range(mint()):
	solve()


from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,input().split())
# l = list(map(int,input().split()))
mod = 10**9 + 7

def mergeSort(arr, n):

    temp_arr = [0]*n
    return _mergeSort(arr, temp_arr, 0, n-1)



def _mergeSort(arr, temp_arr, left, right):



    inv_count = 0



    if left < right:



        mid = (left + right)//2


        inv_count = _mergeSort(arr, temp_arr, left, mid)


        inv_count += _mergeSort(arr, temp_arr, mid + 1, right)



        inv_count += merge(arr, temp_arr, left, mid, right)
    return inv_count

def merge(arr, temp_arr, left, mid, right):
    i = left
    j = mid + 1
    k = left
    inv_count = 0



    while i <= mid and j <= right:

        # There will be no inversion if arr[i] <= arr[j]

        if arr[i] <= arr[j]:
            temp_arr[k] = arr[i]
            k += 1
            i += 1
        else:


            temp_arr[k] = arr[j]
            inv_count += (mid-i + 1)
            k += 1
            j += 1


    while i <= mid:
        temp_arr[k] = arr[i]
        k += 1
        i += 1


    while j <= right:
        temp_arr[k] = arr[j]
        k += 1
        j += 1


    for loop_var in range(left, right + 1):
        arr[loop_var] = temp_arr[loop_var]

    return inv_count

t = int(input())

for _ in range(t):

    n = int(input())
    s = input()
    t = input()
    if sorted(s)!=sorted(t):
        print('NO')
    else:
        hash = defaultdict(int)
        flag = 0
        for i in s:
          hash[i]+=1
          if hash[i]>1:
            print('YES')
            flag = 1
            break
        if not flag:

          l1 = [ord(i) for i in s]
          l2 = [ord(i) for i in t]
          z1 = mergeSort(l1,n)
          z2 = mergeSort(l2,n)

          if z1%2!=z2%2:
            print('NO')
          else:
            print('YES')





import random


def count_lens(t):
 t=list(t)
 n=len(t)
 res=0
 for _ in range(n):
  for k in range (n-1):
   if t[k]>t[k+1]:
    t[k],t[k+1]=t[k+1],t[k]
    res+=1
    
 return (res) % 2


def prog():
    input()
    a, b = input(), input()
    if sorted(a) != sorted(b):
        print("NO")
        return

    if len(set(a)) < len(a):
        print("YES")
        return

    print("YES" if count_lens(a) == count_lens(b) else "NO")


t = int(input())
for _ in range(t):
    prog()

import sys
 
def minp():
	return sys.stdin.readline().strip()
 
def mint():
	return int(minp())
 
def mints():
	return map(int,minp().split())
 
def solve():
	n = mint()
 
	s = list(minp())
	t = list(minp())
	if sorted(t) != sorted(s):
		print("NO")
		return
 
	for i in range(26):
		if s.count(chr(ord('a')+i)) > 1:
			print("YES")
			return
	r = 0
	for i in range(len(s)):
		for j in range(i+1,len(s)):
			if t.index(s[i]) > t.index(s[j]):
				r += 1
	#print(r)
	print(["NO","YES"][r%2 == 0])
 
for i in range(mint()):
	solve()

import sys

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

def mint():
	return int(minp())

def mints():
	return list(map(int,minp().split()))

def solve():
	n = mint()

	s = list(minp())
	t = list(minp())
	if sorted(t) != sorted(s):
		print("NO")
		return
	if len(s) > 26:
		print("YES")
		return

	for i in range(26):
		if s.count(chr(ord('a')+i)) > 1:
			print("YES")
			return
	r = 0
	for i in range(len(s)):
		if s[i] != t[i]:
			jj = i
			for j in range(i+1,len(s)):
				if s[j] == t[i]:
					jj = j
					break
			for j in range(jj-1,i-1,-1):
				s[j],s[j+1] = s[j+1], s[j]
				r += 1
	#print(r)
	print(["NO","YES"][r%2 == 0])

for i in range(mint()):
	solve()


from collections import*
h=input
q=len
r=range
f=lambda s:(Counter(s),q(set(s))==q(s)and sum(s[i]>s[j]for i in r(q(s))for j in r(i,q(s)))&1)
for _ in r(int(h())):
    n,s,t=h(),h(),h()
    print("YNEOS"[f(s)!=f(t)::2])

import sys
 
def minp():
	return sys.stdin.readline().strip()
 
def mint():
	return int(minp())
 
def mints():
	return map(int,minp().split())
 
def solve():
	n = mint()
 
	s = list(minp())
	t = list(minp())
	if sorted(t) != sorted(s):
		print("NO")
		return
 
	for i in range(26):
		if s.count(chr(ord('a')+i)) > 1:
			print("YES")
			return
	r = 0
	for i in range(len(s)):
		for j in range(i+1,len(s)):
			if t.index(s[i]) > t.index(s[j]):
				r += 1
	#print(r)
	print(["NO","YES"][r%2 == 0])
 
for i in range(mint()):
	solve()


def getInvCount(arr):
    inv_count = 0
    for i in range(len(arr)):
        for j in range(i + 1, len(arr)):
            if arr[i] > arr[j]:
                inv_count += 1

    return inv_count


q = int(input())
for i in range(q):
    n = int(input())
    s = input()
    t = input()
    if set(s) != set(t):
        print("NO")
        continue
    if len(set(s)) < len(s):
        print("YES")
        continue
    else:
        if len(s) <= 26 and getInvCount(list(s)) % 2 == getInvCount(list(t)) % 2:
            print("YES")
        else:
            print("NO")




from collections import Counter


def moves_needed_when_there_is_no_repeated_char(st):
    size_st = len(st)
    sloution = 0
    for _ in range(size_st):
        for ind in range(size_st-1):
            if st[ind] > st[ind + 1]:
                st[ind] , st[ind+1] = st[ind+1] , st[ind]
                sloution+=1
    return sloution % 2

def check_number_of_chars(st1, st2):
    cnt_a = Counter(st1)
    cnt_b = Counter(st2)

    if cnt_a != cnt_b:
        return False
    else:
        return True


def is_equal(st1, st2 , number):

    if st1 == st2:
        return True

    if not check_number_of_chars(st1, st2):
        return False

    if len(set(st1)) < len(st1) or len(set(st2)) < len(st2):
        return True

    if  moves_needed_when_there_is_no_repeated_char(st1) == moves_needed_when_there_is_no_repeated_char(st2):
        return True
    else:
        return False


for _ in range(int(input())):
    n = int(input())
    a = list(input())
    b = list(input())
    if is_equal(a , b , n):
        print("YES")
    else:
        print("NO")


from string import ascii_lowercase

q = int(input())

for _ in range(q):
	n = int(input())
	A = input()
	B = input()

	c_a = {}
	c_b = {}

	ans = False

	if sorted(A) == sorted(B):
		inv_a = 0
		inv_b = 0
		has_multi = False

		for a in A:
			for k in c_a:
				if k > a:
					inv_a += c_a[k]

			if a not in c_a:
				c_a[a] = 0

			c_a[a] += 1

		for b in B:
			for k in c_b:
				if k > b:
					inv_b += c_b[k]

			if b not in c_b:
				c_b[b] = 0

			c_b[b] += 1

		for val in list(c_a.values()):
			has_multi = has_multi or (val > 1)

		if inv_a % 2 == inv_b % 2:
			ans = True

		elif has_multi:
			ans = True

	if ans:
		print("YES")
	else:
		print("NO")


for _ in range(int(input())):
    n = int(input())
    s1, s2 = input(), input()
    a1, a2 = [0]*26, [0]*26
    for v in map(ord, s1):
        a1[v-97] += 1
    for v in map(ord, s2):
        a2[v-97] += 1
    
    if a1 != a2:
        print('NO')
        continue
    if max(a1) > 1:
        print('YES')
        continue

    inv1 = sum(c1 > c2 for i, c1 in enumerate(s1) for c2 in s1[i+1:])
    inv2 = sum(c1 > c2 for i, c1 in enumerate(s2) for c2 in s2[i+1:])
    print('YES' if inv1 % 2 == inv2 % 2 else 'NO')

from collections import *
f=lambda s:(Counter(s),len(set(s))==len(s)and sum(s[i]>s[j] for i in range(len(s))for j in range(i,len(s)))&1)
for _ in range(int(input())):
    n,s,t=input(),input(),input()
    print("YNEOS"[f(s)!=f(t)::2])