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.
import java.util.*;

import java.io.*;

public class B {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}

	public long gcd(long x, long y) {
		if (y == 0) {
			return x;
		}
		if (x == 0) {
			return y;
		}
		return gcd(y, x % y);
	}

	public boolean prime(long x) {
		for (int i = 2; i * i <= x; i++) {
			if (x % i == 0) {
				return false;
			}
		}
		return true;
	}

	public long pow(long x, long p) {
		if (p == 0) {
			return 1;
		}
		long t = pow(x, p / 2);
		t *= t;
		t %= mod;
		if (p % 2 == 1) {
			t *= x;
			t %= mod;
		}
		return t;
	}

	public class Fenvik {
		long[] sum;

		public Fenvik(int n) {
			sum = new long[n];
		}

		public void add(int x, long d) {
			for (int i = x; i < sum.length; i = (i | (i + 1))) {
				sum[i] += d;
			}
		}

		public long sum(int r) {
			long ans = 0;
			for (int i = r; i >= 0; i = (i & (i + 1)) - 1) {
				ans += sum[i];
			}
			return ans;
		}

		public long sum(int l, int r) {
			if (l > r) {
				return 0;
			}
			return sum(r) - sum(l - 1);
		}
	}

	public class Pair implements Comparable<Pair> {
		int x;
		int y;

		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Pair o) {
			if (x > o.x) {
				return 1;
			}
			if (x < o.x) {
				return -1;
			}
			if (y > o.y) {
				return 1;
			}
			if (y < o.y) {
				return -1;
			}
			return 0;
		}
	}

	long mod = 1000000007;

	public class Vector implements Comparable<Vector> {
		int x;
		int y;

		public Vector(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		public int quater() {
			if (x > 0 && y >= 0) {
				return 1;
			}
			if (y > 0 && x <= 0) {
				return 2;
			}
			if (y <= 0 && x < 0) {
				return 3;
			}
			return 4;
		}

		@Override
		public int compareTo(Vector o) {
			if (quater() != o.quater()) {
				return quater() - o.quater();
			}
			return -dp(this, o);
		}
	}

	public int dp(Vector a, Vector b) {
		return a.x * b.y - a.y * b.x;
	}

	public double[] leftAdd(double[] auxil, double[] input) {
		double[] ans = new double[auxil.length + input.length];
		for (int i = 0; i < auxil.length; i++) {
			ans[i] = auxil[i];
		}
		for (int i = 0; i < input.length; i++) {
			ans[i + auxil.length] = input[i];
		}
		return ans;
	}

	public double[] tensorProduct(double[] auxil, double[] input) {
		double[] ans = new double[auxil.length * input.length];
		for (int i = 0; i < auxil.length; i++) {
			for (int j = 0; j < input.length; j++) {
				ans[i * input.length + j] = auxil[i] * input[j];
			}
		}
		return ans;
	}

	public double[] tensorProductSquare(double[] auxil, double[] input) {
		double[] ans = new double[auxil.length * input.length * input.length];
		for (int i = 0; i < auxil.length; i++) {
			for (int j = 0; j < input.length; j++) {
				for (int k = 0; k < input.length; k++) {
					ans[i * input.length * input.length + j * input.length + k] = auxil[i] * input[j] * input[k];
				}
			}
		}
		return ans;
	}

	public double[] halfTensor(double[] auxil, double[] input) {
		int halfLa = auxil.length / 2;
		int halfLi = input.length / 2;
		double[] left = new double[halfLa + halfLi];
		for (int i = 0; i < halfLa; i++) {
			left[i] = auxil[i];
		}
		for (int i = 0; i < halfLi; i++) {
			left[halfLa + i] = input[i];
		}
		double[] right = new double[auxil.length + input.length - halfLa - halfLi];
		for (int i = halfLa; i < auxil.length; i++) {
			right[i - halfLa] = auxil[i];
		}
		for (int i = halfLi; i < input.length; i++) {
			right[auxil.length - halfLa + i - halfLi] = input[i];
		}
		auxil = left;
		input = right;
		return tensorProduct(auxil, input);
	}

	public double[] resize(double[] input) {
		int pow = 1;
		while (pow < input.length) {
			pow *= 2;
		}
		double[] ans = new double[pow];
		for (int i = 0; i < input.length; i++) {
			ans[i] = input[i];
		}
		for (int i = input.length; i < ans.length; i++) {
			ans[i] = 0;
		}
		return ans;
	}

	public void normalize(double[] input) {
		double norm = 0;
		for (int i = 0; i < input.length; i++) {
			norm += input[i] * input[i];
		}
		norm = Math.sqrt(norm);
		for (int i = 0; i < input.length; i++) {
			input[i] /= norm;
		}
	}

	public double[] transformation(int mode, double[] auxil, double[] input, boolean norm) {
		if (mode == 1) {
			input = leftAdd(auxil, input);
		} else if (mode == 2) {
			input = tensorProduct(auxil, input);
		} else if (mode == 3) {
			input = tensorProductSquare(auxil, input);
		} else if (mode == 4) {
			input = halfTensor(auxil, input);
		}
		input = resize(input);
		if (norm) {
			normalize(input);
		}
		return input;
	}

	public void solve() {
		for (int qwerty = in.nextInt(); qwerty > 0; qwerty--) {
			int n = in.nextInt();
			String s1 = in.next();
			String s2 = in.next();
			ArrayList<Integer> ans = new ArrayList<>();
			boolean swap = false;
			int delta = 0;
			for (int i = n - 1; i >= 0; i--) {
				if (swap) {
					int j = delta - i;
					if (s1.charAt(j) == s2.charAt(i)) {
						if (s1.charAt(delta) != s1.charAt(j)) {
							ans.add(0);
						}
						ans.add(i);
						delta = delta - i;
						swap = !swap;
					}
				} else {
					int j = delta + i;
					if (s1.charAt(j) != s2.charAt(i)) {
						if (s1.charAt(delta) != s1.charAt(j)) {
							ans.add(0);
						}
						ans.add(i);
						delta = delta + i;
						swap = !swap;
					}
				}
			}
			out.print(ans.size() + " ");
			for (Integer i : ans) {
				out.print(i + 1 + " ");
			}
			out.println();
		}
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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