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;
bool CMP(int a, int b) { return a > b; }
long long int p = 1e9 + 7;
long long int power2(long long int n) {
  long long int res = 1;
  for (long long int i = 1; i <= n; i++) res *= 2;
  return res;
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int cnt1 = 0, u, cnt = 0, n;
vector<vector<long long int>> adj1(200010);
vector<long long int> wt(200010);
long long int visi[310068], vis[300100], last1[10000];
vector<long long int> viso;
bool ok = false;
long long int m, ans = 0;
void dfs(long long int k, vector<vector<long long int>> adj) {
  vis[k] = 1;
  for (long long int i = 0; i < adj[k].size(); i++)
    if (vis[adj[k][i]] == 0) dfs(adj[k][i], adj);
}
long long int dp[200010];
bool mycompare(string s, string t) {
  string x = s + t;
  string y = t + s;
  if (x > y)
    return 1;
  else
    return 0;
}
long long int maxi = 1e7;
set<long long int> w;
pair<long long int, long long int> rotate(long long int x, long long int y,
                                          long long int a, long long int b,
                                          long long int t) {
  long long int i;
  for (i = 0; i < t; i++) {
    long long int p = a + b - y, q = x + b - a;
    x = p, y = q;
  }
  pair<long long int, long long int> P = make_pair(x, y);
  return P;
}
long long int dist(long long int x1, long long int y1, long long int x2,
                   long long int y2) {
  long long int d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
  return d;
}
bool check(long long int x1, long long int y1, long long int x2,
           long long int y2, long long int x3, long long int y3,
           long long int x4, long long int y4) {
  long long int d2 = dist(x1, y1, x2, y2);
  long long int d3 = dist(x1, y1, x3, y3);
  long long int d4 = dist(x1, y1, x4, y4);
  if (d2 == 0 || d3 == 0 || d4 == 0) return false;
  if (d2 == d3 && d4 == 2 * d2 &&
      2 * dist(x2, y2, x4, y4) == dist(x2, y2, x3, y3))
    return true;
  if (d3 == d4 && d2 == 2 * d3 &&
      2 * dist(x2, y2, x3, y3) == dist(x3, y3, x4, y4))
    return true;
  if (d2 == d4 && d3 == 2 * d2 &&
      2 * dist(x2, y2, x3, y3) == dist(x2, y2, x4, y4))
    return true;
  return false;
}
long long int A[20010];
class SegmentTree {
 public:
  vector<long long int> A;
  vector<long long int> tree;
  long long int n, d;
  SegmentTree(vector<long long int> &inp, long long int depth) {
    A = inp;
    d = depth;
    n = A.size();
    tree.resize(4 * n);
    build(1, 0, n - 1, d);
  }
  void build(long long int node, long long int start, long long int end,
             long long int depth) {
    if (start == end)
      tree[node] = A[start];
    else {
      long long int mid = (start + end) / 2;
      build(2 * node, start, mid, depth - 1);
      build(2 * node + 1, mid + 1, end, depth - 1);
      if (depth % 2 == 1)
        tree[node] = tree[2 * node] | tree[2 * node + 1];
      else
        tree[node] = tree[2 * node] ^ tree[2 * node + 1];
    }
  }
  void update(long long int node, long long int start, long long int end,
              long long int idx, long long int depth) {
    if (start == end) {
      tree[node] = A[start];
    } else {
      long long int mid = (start + end) / 2;
      if (start <= idx && idx <= mid)
        update(2 * node, start, mid, idx, depth - 1);
      else
        update(2 * node + 1, mid + 1, end, idx, depth - 1);
      if (depth % 2 == 1)
        tree[node] = tree[2 * node] | tree[2 * node + 1];
      else
        tree[node] = tree[2 * node] ^ tree[2 * node + 1];
    }
  }
  long long int update(long long int index, long long int value) {
    A[index] = value;
    update(1, 0, n - 1, index, d);
    return tree[1];
  }
};
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int>>,
               greater<pair<long long int, long long int>>>
    pq;
void path(long long int x) {
  if (x == 0) return;
  path(visi[x]);
  cout << x << " ";
}
long long int sum[2000100] = {0};
long long int MEX(vector<long long int> &cnt) {
  for (long long int i = 0; i < cnt.size(); i++)
    if (cnt[i] == 0) return i;
}
long long int per[300200];
string s, curr, reqd = "abacaba";
bool check(int idx) {
  s = curr;
  for (int i = 0; i < 7; i++) {
    if (s[idx + i] == reqd[i]) continue;
    if (s[idx + i] != '?') return 0;
    s[idx + i] = reqd[i];
  }
  int cnt = 0;
  for (int i = 0; i + 6 < s.size(); i++)
    if (s.substr(i, 7) == reqd) cnt++;
  for (auto &it : s)
    if (it == '?') it = 'z';
  return (cnt == 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    deque<char> s;
    vector<char> k, k1;
    for (long long int i = 0; i < n; i++) {
      s.push_back(a[i]);
      k.push_back(a[i]);
      k1.push_back(b[i]);
    }
    bool ok = false;
    vector<long long int> ans;
    long long int cnt = 0;
    for (long long int i = 0; i < n - 1; i++) {
      if (k[i] != k[i + 1]) {
        cnt++;
        ans.push_back(i + 1);
      }
    }
    if (k[n - 1] == '1') {
      cnt++;
      ans.push_back(n);
    }
    vector<long long int> ans1;
    long long int u = 0;
    for (long long int i = 0; i < n - 1; i++) {
      if (k1[i] != k1[i + 1]) {
        u++;
        ans1.push_back(i + 1);
      }
    }
    if (k1[n - 1] == '1') {
      u++;
      ans1.push_back(n);
    }
    reverse((ans1).begin(), (ans1).end());
    cout << cnt + u << " ";
    for (auto x : ans) cout << x << " ";
    for (auto x : ans1) cout << x << " ";
    cout << endl;
  }
}