This is the easy version of the problem. The difference between the versions is the constraint on n and the required number of operations. You can make hacks only if all versions of the problem are solved.

There are two binary strings a and b of length n (a binary string is a string consisting of symbols 0 and 1). In an operation, you select a prefix of a, and simultaneously invert the bits in the prefix (0 changes to 1 and 1 changes to 0) and reverse the order of the bits in the prefix.

For example, if a=001011 and you select the prefix of length 3, it becomes 011011. Then if you select the entire string, it becomes 001001.

Your task is to transform the string a into b in at most 3n operations. It can be proved that it is always possible.

Input

The first line contains a single integer t (1≤ t≤ 1000) — the number of test cases. Next 3t lines contain descriptions of test cases.

The first line of each test case contains a single integer n (1≤ n≤ 1000) — the length of the binary strings.

The next two lines contain two binary strings a and b of length n.

It is guaranteed that the sum of n across all test cases does not exceed 1000.

Output

For each test case, output an integer k (0≤ k≤ 3n), followed by k integers p_1,…,p_k (1≤ p_i≤ n). Here k is the number of operations you use and p_i is the length of the prefix you flip in the i-th operation.

Example

Input


5
2
01
10
5
01011
11100
2
01
01
10
0110011011
1000110100
1
0
1


Output


3 1 2 1
6 5 2 5 3 1 2
0
9 4 1 2 10 4 1 2 1 5
1 1

Note

In the first test case, we have 01→ 11→ 00→ 10.

In the second test case, we have 01011→ 00101→ 11101→ 01000→ 10100→ 00100→ 11100.

In the third test case, the strings are already the same. Another solution is to flip the prefix of length 2, which will leave a unchanged.
# Codeforces round 655

'''test=int(input())
for i in range(test):
    n=int(input())
    arr=[1 for i in range(n)]
    print(*arr)'''

'''test=int(input())
for i in range(test):
    n=int(input())
    i=2
    arr=[]
    while i**2<=n:
        if n%i==0:
            arr.append(i)
            arr.append(n/i)
        i+=1
    if arr:
        k=max(arr)
        print(int(k),int(n-k))
    else:
        print(1,n-1)'''

'''test=int(input())
for i in range(test):
    n=int(input())
    arr=[int(i) for i in input().split()]
    t=arr.copy()
    t.sort()
    j=n
    for i in range(n-1,-1,-1):
        if arr[i]==t[i]:
            j-=1
        else:
            break
    arr=arr[:j]
    if not arr:
        print(0)
    else:
        dp=[0 for j in range(len(arr))]
        for i in range(len(arr)):
            if arr[i]==t[i]:
                dp[i]=1
            else:
                dp[i]=0
        cnt=0
        recent=-1
        for i in range(1,len(arr)):
            if dp[i]==1 and dp[i-1]==0:
                cnt+=1
        print(dp)
        if not cnt:
            print(1)
        else:
            cnt+=1 if dp[-1]==0 else 0
            print(cnt)'''


#codeforces educational round
'''string=input()
patt=input()
from collections import defaultdict
ans=float("inf")
cnt=defaultdict(int)
for i in patt:
    cnt[i]+=1
l=0
cnt_2=defaultdict(int)
for i in range(len(string)):
    if string[i] in patt:
        cnt_2[string[i]]+=1
    print(cnt_2)
    flag=0
    while all(cnt[k]==cnt_2[k] for k in cnt.keys()):
        if string[l] in patt:
            cnt_2[string[l]]-=1
        l+=1
        flag=1
    if flag:
        l-=1
        cnt_2[string[l]]+=1
        flag=0
        print(l)
        ans=min(ans,i-l+1)
        print(i-l+1)

print(ans)'''
    
'''n,m=[int(i) for i in input().split()]
if m==n:
    s=""
    for i in range(m):
        s+="10"
    print(s)
elif m>n:
    if m>2*(n+1):
        print(-1)
    else:
        s=""
        for i in range(m-n-1):
            s+="110"
        for j in range(2*(n+1)-m):
            s+="10"
        print(s[:m+n])
else:
    if n>m+1:
        print(-1)
    else:
        s=""
        for j in range(m):
            s+="01"
        s+="0"
        print(s)'''

'''n=int(input())
dates=[]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    dates.append([a,b])
dates.sort(key=lambda x: x[0])
ans=dates[0][1]
from collections import defaultdict
cnt=defaultdict(int)
for i in range(n):
    if cnt[dates[i][0]]<dates[i][1]:
        cnt[dates[i][0]]=dates[i][1]
        
#print(cnt)
for i in range(1,n):
    if cnt[dates[i][0]]>=ans:
        ans=cnt[dates[i][0]]
    else:
        ans=dates[i][0]
print(ans)
print (cnt)'''
    

'''n=int(input())
arr=[int(i) for i in input().split()]
from collections import defaultdict
cnt=defaultdict(int)
for i in arr:
    cnt[i]+=1
k=max(arr)
dp=[0 for i in range(k+1)]
dp[0]=0
dp[1]=cnt[1]
for i in range(2,k+1):
    dp[i]=max(dp[i-1],dp[i-2] + cnt[i]*i)
    #print(dp[i])
print(dp[-1])'''

#Codeforces round 656 DIV-3
'''test=int(input())
for i in range(test):
    x,y,z=[int(i) for i in input().split()]
    if x==y==z:
        print("YES")
        print(x,y,z)
    else:
        if z==x and y<x:
            print("YES")
            print(y,x,max(1,y-1))
        elif y==z and x<y:
            print("YES")
            print(x,max(1,x-1),y)
        elif x==y and z<y:
            print("YES")
            print(x,z,max(1,z-1))
        else:
            print("NO")
'''

'''def check(num,curr):
    if not num:
        return True
    if len(num)==1:
        if num[0]>=curr:
            return True
        return False
    if num[0]<=num[-1] and num[0]>=curr:
        return True and check(num[1:],min(num[0],num[-1]))
    elif num[0]>=num[-1] and num[-1]>=curr:
        return True and check(num[:-1],min(num[0],num[-1]))
    return False'''
'''test=int(input())
for i in range(test):
    n=int(input())
    arr=[int(i) for i in input().split()]
    j=n-1
    flag=1
    while j>0:
        if arr[j]>arr[j-1]:
            flag=0
            break
        j-=1
    while j>0:
        if arr[j]<arr[j-1]:
            flag=0
            break
        j-=1
    if not flag:
        ans=j
    else:
        ans=0
    print(ans)'''


    






'''def min_(l,r,ch):
    cnt=0
    for i in range(l,r+1):
        if s[i]!=ch:
            cnt+=1
    return cnt 
def check(l,r,t):
    if l==r:
        if s==chr(ord("a")+t):
            return 0
        return 1
    mid=(l+r)//2
    
    return min(check(mid+1,r,t+1)+min_(l,mid,chr(ord("a")+t)),
           check(l,mid,t+1)+min_(mid+1,r,chr(ord("a")+t)))
        
test=int(input())
for i in range(test):
    n=int(input())
    s=str(input())
    print(check(0,n-1,0))'''
            

        
'''test=int(input())
for i in range(test):
    n=int(input())
    s=input()
    cnt=0
    t="abacaba"
    for i in range(n-6):
        flag=1
        for j in range(7):
            if s[i+j]!=t[j]:
                flag=0
        if flag:
            cnt+=1
    if cnt==1:
        print("YES")
        for j in range(n):
            if s[j]=="?":
                s=s[:j]+"z"+s[j+1:]
        print(s)
    elif cnt==0:
        opt=-1
        for i in range(n-6):
            flag=1
            for j in range(7):
                if s[i+j]==t[j] or s[i+j]=="?":
                    continue
                else:
                    flag=0
                    break

            if flag:
                opt=i
                break
        if opt!=-1:
            for i in range(7):
                if s[opt+i]=="?":
                    s=s[:opt+i]+t[i]+s[opt+i+1:]
                
            for i in range(n):
                if s[i]=="?":
                    s=s[:i]+"z"+s[i+1:]
            cnt_=0
            for i in range(n-6):
                flag=1
                for j in range(7):
                    if s[i+j]!=t[j]:
                        flag=0
                if flag:
                    cnt_+=1
            if cnt_==1:
            
                print("Yes")
                print(s)
            else:
                print("NO")
        else:
            print("NO")
    else:
        print("NO")'''


            



'''test=int(input())
for i in range(test):
    initial=[int(i) for i in input().split()]
    n=initial[0]
    m=initial[1]
    a=[]
    b=[]
    for j in range(m):
        k,p=[int(i) for i in input().split()]
        a.append(k)
        b.append([k,p])
    a.sort()
    pre=[0 for i in range(m)]
    pre[-1]=a[-1]
    for i in range(m-2,-1,-1):
        pre[i]=a[i]+pre[i+1]
    cnt=0
    for i in range(m):
        l=0
        r=m-1
        ans=m
        while l<=r:
            mid=l+(r-l)//2
            if a[mid]>= b[i][1]:
                ans=mid
                r=mid-1
            else:
                l=mid+1
        if ans!=m:
            t=n-(m-ans)
            cnt=max(cnt,pre[ans]+(t)*b[i][1])
        else:
            cnt=max(cnt,b[i][0]+(n-1)*(b[i][1]))
        print(cnt)
    print(cnt)'''

'''test=int(input())
for i in range(test):
    n,m=[int(i) for i in input().split()]
    a=[int(i) for i in input().split()]
    b=[int(i) for i in input().split()]
    ele_1=set()
    for i in a:
        ele_1.add(i)
    ans=-1
    for j in b:
        if j in ele_1:
            ans=j
            break
    if ans!=-1:
        print("YES")
        print(1,ans,sep=" ")
       
    else:
        print("NO")
'''
'''test=int(input())
for i in range(test):
    n=int(input())
    arr=[int(i) for i in input().split()]
    win="First"
    i=0
    cnt=0
    for i in range(n-1):
        if arr[i]==1:
            cnt+=1
        else:break
    if cnt%2:
        print("Second")
    else:
        print("First")'''

test=int(input())
for i in range(test):
    n=int(input())
    a=[i for i in input()]
    b=[i for i in input()]
    ans=[]
    if a==b:
        print(0)
    else:
        for i in range(n-1,-1,-1):
            if a[i]!=b[i]:
                if a[i]!=a[0]:
                    ans.append(1)
                    a[0]=a[i]
                for i in range(i+1):
                    if a[i]=="0":
                        a[i]='1'
                    else:
                        a[i]="0"
                a[:i+1]=a[:i+1][::-1]
                
                ans.append(i+1)
        print(len(ans),*ans,sep=" ")




