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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int nCrModPFermat(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long int modFact(long long int n, long long int p) {
  long long int result = 1;
  for (long long int i = 1; i <= n; i++) result = (result * i) % p;
  return result;
}
int fact(int n);
int nCr(int n, int r) { return fact(n) / (fact(r) * fact(n - r)); }
int fact(int n) {
  int res = 1;
  for (int i = 2; i <= n; i++) res = res * i;
  return res;
}
void solve(long long int n, long long int a, long long int b, long long int c,
           long long int* arr) {
  long long int x = -100000;
  ;
  long long int y = -100000;
  ;
  long long int z = -100000;
  ;
  if (n > a) {
    if (arr[n - a] == -1) solve(n - a, a, b, c, arr);
    x = arr[n - a];
  }
  if (n > b) {
    if (arr[n - b] == -1) solve(n - b, a, b, c, arr);
    y = arr[n - b];
  }
  if (n > c) {
    if (arr[n - c] == -1) solve(n - c, a, b, c, arr);
    z = arr[n - c];
  }
  if (n == a) x = 0;
  if (n == b) y = 0;
  if (n == c) z = 0;
  arr[n] = max(max(x, y), z) + 1;
}
long long Divisors(long long n, long long y) {
  long long s = 0;
  long long i = n / (y + 1);
  i = max(i, (long long)1);
  for (; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i <= y + 1 && i < n / i - 1) s++;
    }
  }
  return s;
}
bool cmp(pair<long long, long long>& a, pair<long long, long long>& b) {
  return a.second < b.second;
}
void sort(map<long long, long long>& M) {
  vector<pair<long long, long long> > A;
  for (auto& it : M) {
    A.push_back(it);
  }
  sort(A.begin(), A.end(), cmp);
}
char notc(char* a) {
  if (*a == '1')
    return '0';
  else
    return '1';
}
string change(string a, long long c, long long n) {
  for (long long i = c; i >= 0; i--) {
    a[i] = notc(&(a[i]));
  }
  char b[n];
  for (long long i = c; i >= 0; i--) {
    b[i] = a[c - i];
  }
  for (long long i = c + 1; i < n; i++) {
    b[i] = a[i];
  }
  return b;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    vector<long long> v;
    long long p = 0;
    for (long long i = n - 1; i >= 0; i--) {
      if (a[i] != b[i]) {
        if ((notc(&(a[0]))) == b[i]) {
          v.push_back(i + 1);
          p++;
          a = change(a, i, n);
        } else {
          v.push_back(1);
          v.push_back(i + 1);
          p += 2;
          a = change(a, 0, n);
          a = change(a, i, n);
        }
      }
    }
    cout << p << " ";
    for (auto i = v.begin(); i != v.end(); i++) {
      cout << *i << " ";
    }
    cout << "\n";
  }
}