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.ArrayList;

public class Main {

	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		FastScanner fs = new FastScanner();
		java.io.PrintWriter out = new java.io.PrintWriter(System.out);
		solve(fs, out);
		out.flush();
	}

	public void solve(FastScanner fs, java.io.PrintWriter out) {
		int t = fs.nextInt();
		while(t --> 0) {
			int n = fs.nextInt();
			char[] a = fs.next().toCharArray(), b = fs.next().toCharArray();
			boolean reverse = false;
			int first = 0;
			ArrayList<Integer> ans = new ArrayList<>();
			for (int i = n - 1;i >= 0;-- i) {
				int index = reverse ? first - i : first + i;
				if ((a[index] != b[i]) ^ reverse) {
					if ((a[first] == b[i]) ^ reverse) ans.add(1);
					ans.add(i + 1);
					reverse = !reverse;
					first = index;
				}
			}
			out.print(ans.size());
			for (int i : ans) out.print(" " + i);
			out.println();
		}
	}

	static class FastScanner {
		private final java.io.InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) return true;
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (java.io.IOException e) {
				e.printStackTrace();
			}
			return buflen > 0;
		}
		private byte readByte() {
			return hasNextByte() ? buffer[ptr++ ] : -1;
		}
		private static boolean isPrintableChar(byte c) {
			return 32 < c || c < 0;
		}
		private static boolean isNumber(int c) {
			return '0' <= c && c <= '9';
		}
		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++ ;
			return hasNextByte();
		}
		public String next() {
			if (!hasNext()) throw new java.util.NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			byte b;
			while (isPrintableChar(b = readByte())) sb.appendCodePoint(b);
			return sb.toString();
		}
		public final long nextLong() {
			if (!hasNext()) throw new java.util.NoSuchElementException();
			long n = 0;
			try {
				byte b = readByte();
				if (b == '-') {
					while(isNumber(b = readByte())) n = n * 10 + '0' - b;
					return n;
				} else if (!isNumber(b)) throw new NumberFormatException();
				do n = n * 10 + b - '0'; while (isNumber(b = readByte()));
			} catch (java.util.NoSuchElementException e) {
			}
			return n;
		}
		public final int nextInt() {
			if (!hasNext()) throw new java.util.NoSuchElementException();
			int n = 0;
			try {
				byte b = readByte();
				if (b == '-') {
					while(isNumber(b = readByte())) n = n * 10 + '0' - b;
					return n;
				} else if (!isNumber(b)) throw new NumberFormatException();
				do n = n * 10 + b - '0'; while (isNumber(b = readByte()));
			} catch (java.util.NoSuchElementException e) {
			}
			return n;
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
	public static class Arrays {
		public static void sort(final int[] array) {
			int l, min = 0xFFFFFFFF, max = 0;
			for (l = 0;l < array.length;++ l) {
				int i = array[l];
				min &= i;
				max |= i;
				if ((i & 0x80000000) == 0) break;
			}
			for (int r = l + 1;r < array.length;++ r) {
				int i = array[r];
				min &= i;
				max |= i;
				if ((i & 0x80000000) != 0) {
					array[r] = array[l];
					array[l ++] = i;
				}
			}
			int use = min ^ max, bit = Integer.highestOneBit(use & 0x7FFFFFFF);
			if (bit == 0) return;
			sort(array, 0, l, use, bit);
			sort(array, l, array.length, use, bit);
		}
		private static void sort(final int[] array, final int left, final int right, final int use, int digit) {
			if (right - left <= 96) {
				for (int i = left + 1;i < right;++ i) {
					int tmp = array[i], tmp2, j;
					for (j = i;j > left && (tmp2 = array[j - 1]) > tmp;-- j) array[j] = tmp2;
					array[j] = tmp;
				}
				return;
			}
			int l = left;
			while(l < right && (array[l] & digit) == 0) ++ l;
			for (int r = l + 1;r < right;++ r) {
				int i = array[r];
				if ((i & digit) == 0) {
					array[r] = array[l];
					array[l ++] = i;
				}
			}
			if ((digit = Integer.highestOneBit(use & digit - 1)) == 0) return;
			sort(array, left, l, use, digit);
			sort(array, l, right, use, digit);
		}
		public static void sort(final long[] array) {
			int l;
			long min = 0xFFFFFFFFFFFFFFFFL, max = 0;
			for (l = 0;l < array.length;++ l) {
				long i = array[l];
				min &= i;
				max |= i;
				if ((i & 0x8000000000000000L) == 0) break;
			}
			for (int r = l + 1;r < array.length;++ r) {
				long i = array[r];
				min &= i;
				max |= i;
				if ((i & 0x8000000000000000L) != 0) {
					array[r] = array[l];
					array[l ++] = i;
				}
			}
			long use = min ^ max, bit = Long.highestOneBit(use & 0x7FFFFFFFFFFFFFFFL);
			if (bit == 0) return;
			sort(array, 0, l, use, bit);
			sort(array, l, array.length, use, bit);
		}
		private static void sort(final long[] array, final int left, final int right, final long use, long digit) {
			if (right - left <= 96) {
				for (int i = left + 1, j;i < right;++ i) {
					long tmp = array[i], tmp2;
					for (j = i;j > left && (tmp2 = array[j - 1]) > tmp;-- j) array[j] = tmp2;
					array[j] = tmp;
				}
				return;
			}
			int l = left;
			while(l < right && (array[l] & digit) == 0) ++ l;
			for (int r = l + 1;r < right;++ r) {
				long i = array[r];
				if ((i & digit) == 0) {
					array[r] = array[l];
					array[l ++] = i;
				}
			}
			if ((digit = Long.highestOneBit(use & digit - 1)) == 0) return;
			sort(array, left, l, use, digit);
			sort(array, l, right, use, digit);
		}
	}

	public static class IntMath {
		public static int gcd(int a, int b) {
			while (a != 0) if ((b %= a) != 0) a %= b; else return a;
			return b;
		}
		public static int gcd(int... array) {
			int ret = array[0];
			for (int i = 1;i < array.length;++ i) ret = gcd(ret, array[i]);
			return ret;
		}
		public static long gcd(long a, long b) {
			while (a != 0) if ((b %= a) != 0) a %= b; else return a;
			return b;
		}
		public static long gcd(long... array) {
			long ret = array[0];
			for (int i = 1;i < array.length;++ i) ret = gcd(ret, array[i]);
			return ret;
		}
		public static long lcm(long a, long b) {
			return a / gcd(a, b) * b;
		}
		public static int pow(int a, int b) {
			int ans = 1;
			for (int mul = a;b > 0;b >>= 1, mul *= mul) if ((b & 1) != 0) ans *= mul;
			return ans;
		}
		public static long powLong(long a, long b) {
			long ans = 1;
			for (long mul = a;b > 0;b >>= 1, mul *= mul) if ((b & 1) != 0) ans *= mul;
			return ans;
		}
		public static int pow(int a, int b, int mod) {
			if (b < 0) b = b % (mod - 1) + mod - 1;
			long ans = 1;
			for (long mul = a;b > 0;b >>= 1, mul = mul * mul % mod) if ((b & 1) != 0) ans = ans * mul % mod;
			return (int)ans;
		}
		public static int floorsqrt(long n) {
			return (int)Math.sqrt(n + 0.1);
		}
		public static int ceilsqrt(long n) {
			return n <= 1 ? (int)n : (int)Math.sqrt(n - 0.1) + 1;
		}
	}
}
