Problem: 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.

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;  
 
public class Solution{
    // public static class pair{
    //     int x;
    //     int y;
    // }
    public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
        public String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}public double nextDouble() {
			return Double.parseDouble(next());
		}
    }
    public static class pair{
        int x;
        int y;
        public pair(int a,int b,int c){
            x=a;
            y=b;
        }
    }
    static long[] fac=fact();
    static long[] fact(){
        long[] fac = new long[200001];
        fac[0] = (long)1;
        for (int i = 1; i < (int)fac.length; i++){
            fac[i] = (fac[i - 1] * i) % 1000000007;
        }
        return fac;
    }
    public static void main(String[] args) throws IOException{
        FastScanner fs=new FastScanner();
		int t=fs.nextInt();
		PrintWriter out=new PrintWriter(System.out);
		while(t-->0){
		    int n=fs.nextInt();
		    char[] a=fs.next().toCharArray();
		    char[] b=fs.next().toCharArray();
		    ArrayList<Integer> moves=new ArrayList<>();
		    for(int i=n-1;i>=0;i--){
		        if(a[i]==b[i]){
		            continue;
		        }else{
		            if(i==0){
		                moves.add(1);
		                break;
		            }
		            if(a[0]!=b[i]){
		                moves.add(i+1);
		                for(int j=0,k=i;j<=k;j++,k--){
		                    char l='0';
		                    char r='0';
		                    if(a[j]=='0'){
		                        l='1';
		                    }
		                    if(a[k]=='0'){
		                        r='1';
		                    }
		                    a[j]=r;
		                    a[k]=l;
		                }
		            }else{
		                moves.add(1);
		                if(a[0]=='0'){
		                    a[0]='1';
		                }else{
		                    a[0]='0';
		                }
		                moves.add(i+1);
		                for(int j=0,k=i;j<=k;j++,k--){
		                    char l='0';
		                    char r='0';
		                    if(a[j]=='0'){
		                        l='1';
		                    }
		                    if(a[k]=='0'){
		                        r='1';
		                    }
		                    a[j]=r;
		                    a[k]=l;
		                }
		            }
		        }
		    }
		    System.out.print(moves.size()+" ");
		    for(int i=0;i<moves.size();i++){
		        System.out.print(moves.get(i)+" ");
		    }
		    System.out.println();
		}
        out.close();
    }
    public static long gcdFind(long[] arr){
        long result = (long)0; 
        for (long element: arr){ 
            result = gcd(result, element);
  
            if(result == (long)1) 
            { 
               return 1; 
            } 
        } 
        return result;
    }
    public static int dfs(int in,ArrayList<Integer>[] adj,HashSet<Integer> set,HashMap<Integer,Integer> vis){
        if(vis.containsKey(in)){
            return 1;
        }
        if(set.contains(in)){
            return 0;
        }
        vis.put(in,1);
        ArrayList<Integer> l=adj[in-1];
        if(l.size()==0){
            return 2;
        }
        return dfs(l.get(0),adj,set,vis);
    }
    public static boolean check(long n){
        String s=n+"";
        HashMap<Integer,Integer> set=new HashMap<>();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)!='0'){
                set.put(s.charAt(i)-'0',1);
            }
        }
        for(int key:set.keySet()){
            if(n%key!=0){
                return false;
            }
        }
        return true;
    }
    public static void sort(long[] array){
		ArrayList<Long> copy = new ArrayList<Long>();
		for (long i : array)
			copy.add(i);
		Collections.sort(copy);
		for(int i = 0;i<array.length;i++)
			array[i] = copy.get(i);
	}
    static long power(long x, long y, long p){
        long res = 1;
        x = x % p;
        while (y > 0) {
            if (y % 2 == 1)
                res = (res * x) % p;
            y = y >> 1; // y = y/2
            x = (x * x) % p;
        }
        return res;
    }
    public static long modInverse(long n, long p){
        return power(n, p - 2, p);
    }
    public static long nCr(long n, long r,long p){
        if (n<r) 
              return (long)0;
        if (r == 0)
            return (long)1;
        return (fac[(int)n] * modInverse(fac[(int)r], p)% p * modInverse(fac[(int)(n - r)], p)% p)% p;
    }public static int upp(int[] arr,int v){
        int low=0;
        int high=arr.length-1;
        int ans=-1;
        while(low<=high){
            int m=(low+high)/2;
            if(arr[m]<v){
                ans=m;
                low=m+1;
            }else{
                high=m-1;
            }
        }
        return ans+1;
    }
    public static int low(int[] arr,int v){
        int low=0;
        int high=arr.length-1;
        int ans=-1;
        while(low<=high){
            int m=(low+high)/2;
            if(arr[m]>v){
                ans=m;
                high=m-1;
            }else{
                low=m+1;
            }
        }
        if(ans==-1){
            return 0;
        }
        return arr.length-ans;
    }
    public static class Comp implements Comparator<pair>{
        public int compare(pair a,pair b){
            if(a.x!=b.x){
                return a.x-b.x;
            }else{
                return a.y-b.y;
            }
        }
    }
    public static long gcd(long a,long b){
        if (b == 0) 
        return a; 
        return gcd(b, a % b);
    }
    public static int lcm(int a,int b){
        int x=Math.max(a,b);
        int y=Math.min(a,b);
        long ans=x;
        while(ans%y!=0){
            ans+=x;
        }
        if(ans>Integer.MAX_VALUE){
            return -1;
        }
        return (int)ans;
    }
    public static long fact(int n){
        long ans=1;
        for(int i=1;i<=n;i++){
            ans*=i;
        }
        return ans;
    }
}