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:
// coded by Krishna Sundar //

import java.lang.*;
import java.io.*;
import java.util.*;

public class Main {

    public void solve(Read input, Write output) throws Exception {
        int cases = input.readInt();
        while (cases-->0) {
            int N = input.readInt();
            String a = input.readString();
            String b = input.readString();
            int[] A = new int[N];
            int[] B = new int[N];
            for (int i=0;i<N;i++) {
                A[i] = a.charAt(i)-'0';
                B[i] = b.charAt(i)-'0';
            }
            int flip = 0;
            int start = 0;
            int end = N-1;
            int rev = 0;
            List<Integer> res = new ArrayList<>();
            for (int i=N-1;i>=0;i--) {
                int currentB = B[i];
                int currentA;
                if (rev==0) {
                    currentA = A[end];
                } else {
                    currentA = A[start];
                }
                if (flip%2==1) {
                    currentA = currentA^1;
                }
                if (currentA==currentB) {
                    if (rev==1) {
                        start++;
                    } else {
                        end--;
                    }
                    continue;
                }
                if (i==0) {
                    res.add(1);
                    break;
                }
                int front = start;
                int back = end;
                if (rev==1) {
                    front = end;
                    back = start;
                }
                if (currentB==0) {
                    int check = A[front];
                    if (flip%2==1) {
                        check = check^1;
                    }
                    if (check==0) {
                        res.add(1);
                    }
                    res.add(i+1);
                } else {
                    int check = A[front];
                    if (flip%2==1) {
                        check = check^1;
                    }
                    if (check==1) {
                        res.add(1);
                    }
                    res.add(i+1);
                }
                if (rev==0) {
                    start++;
                } else {
                    end--;
                }
                rev = rev^1;
                flip++;
            }

            output.print(res.size());
            output.print(" ");
            for (int i=0;i<res.size();i++) {
                output.print(res.get(i));
                output.print(" ");
            }
            output.print("\n");
            output.flush();
            /*int N = input.readInt();
            if (N==1) {
                output.printLine("1");
                continue;
            }
            Map<Integer, List<Integer>> tree = new HashMap<>();
            for (int i=1;i<=N;i++) {
                tree.put(i, new ArrayList<>());
            }
            int start = -1;
            for (int i=0;i<N-1;i++) {
                int u = input.readInt();
                int v = input.readInt();
                tree.get(u).add(v);
                tree.get(v).add(u);
                start = u;
            }
            Queue<Integer> Q = new LinkedList<>();
            Q.add(start);
            Q.add(1);
            int max_level = 1;
            int max_level_node = start;
            boolean[] visited = new boolean[N+1];
            while (!Q.isEmpty()) {
                int parent = Q.remove();
                int level = Q.remove();
                visited[parent] = true;
                if (level>max_level) {
                    max_level = level;
                    max_level_node = parent;
                }
                for (Integer C : tree.get(parent)) {
                    if (!visited[C]) {
                        visited[C] = true;
                        Q.add(C);
                        Q.add(level+1);
                    }
                }
            }
            Q = new LinkedList<>();
            Q.add(max_level_node);
            Q.add(1);
            max_level = 1;
            visited = new boolean[N+1];
            while (!Q.isEmpty()) {
                int parent = Q.remove();
                int level = Q.remove();
                visited[parent] = true;
                if (level>max_level) {
                    max_level = level;
                    max_level_node = parent;
                }
                for (Integer C : tree.get(parent)) {
                    if (!visited[C]) {
                        visited[C] = true;
                        Q.add(C);
                        Q.add(level+1);
                    }
                }
            }
            int[] res = new int[N+1];
            Q = new LinkedList<>();
            Q.add(max_level_node);
            Q.add(1);
            visited = new boolean[N+1];
            while (!Q.isEmpty()) {
                int parent = Q.remove();
                int level = Q.remove();
                res[parent] = level;
                visited[parent] = true;
                for (Integer C : tree.get(parent)) {
                    if (!visited[C]) {
                        visited[C] = true;
                        Q.add(C);
                        Q.add(level+1);
                    }
                }
            }
            for (int i=1;i<=N;i++) {
                output.print(res[i]);
                if (i!=N) {
                    output.print(" ");
                }
            }
            output.print("\n");*/
        }
    }

    public static void main(String[] args) throws Exception {
        Read input = new Read();
        Write output = new Write();
        Main D = new Main();
        D.solve(input, output);
        output.flush();
        output.close();
    }

    // java fast io reader and writer
    // taken from various sources and customized

    static class Read {

        private byte[] buffer =new byte[10*1024];
        private int index;
        private InputStream input_stream;
        private int total;

        public Read() {
            input_stream = System.in;
        }

        public int read()throws IOException {
            if(total<0)
                throw new InputMismatchException();
            if(index>=total) {
                index=0;
                total= input_stream.read(buffer);
                if(total<=0)
                    return -1;
            }
            return buffer[index++];
        }

        public long readLong() throws IOException {
            long number=0;
            int n= read();
            while(isWhiteSpace(n))
                n= read();
            long neg=1l;
            if(n=='-') {
                neg=-1l;
                n= read();
            }
            while(!isWhiteSpace(n)) {
                if(n>='0'&&n<='9') {
                    number*=10l;
                    number+=(long)(n-'0');
                    n= read();
                }
                else throw new InputMismatchException();
            }
            return neg*number;
        }

        public int readInt() throws IOException {
            int integer=0;
            int n= read();
            while(isWhiteSpace(n))
                n= read();
            int neg=1;
            if(n=='-') {
                neg=-1;
                n= read();
            }
            while(!isWhiteSpace(n)) {
                if(n>='0'&&n<='9') {
                    integer*=10;
                    integer+=n-'0';
                    n= read();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }

        public double readDouble()throws IOException {
            double doub=0;
            int n= read();
            while(isWhiteSpace(n))
                n= read();
            int neg=1;
            if(n=='-') {
                neg=-1;
                n= read();
            }
            while(!isWhiteSpace(n)&&n!='.') {
                if(n>='0'&&n<='9') {
                    doub*=10;
                    doub+=n-'0';
                    n= read();
                }
                else throw new InputMismatchException();
            }

            if(n=='.') {
                n= read();
                double temp=1;
                while(!isWhiteSpace(n)) {
                    if(n>='0'&&n<='9') {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n= read();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }

        public String readString()throws IOException {
            StringBuilder sb = new StringBuilder();
            int n = read();
            while (isWhiteSpace(n))
                n = read();
            while (!isWhiteSpace(n)) {
                sb.append((char)n);
                n = read();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if(n==' '|| n=='\n'|| n=='\r'|| n=='\t'|| n==-1)
                return true;
            return false;
        }
    }

    static class Write {

        private final BufferedWriter bw;

        public Write() {
            bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }
        public void print(Object str) throws IOException {
            bw.append(str+"");
        }
        public void printLine(Object str) throws IOException {
            print(str);
            bw.append("\n");
        }
        public void close()throws IOException {
            bw.close();
        }
        public void flush()throws IOException {
            bw.flush();
        }
    }
}