#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       string a;       cin >> a;       string b;       cin >> b;       string c = a;       int flag = 0;       int count = 0;       vector<int> ans;       int s = 1;       int e = n;       for (int i = n - 1; i >= 0; --i) {         char x;         if (flag == 0) {           x = a[s - 1];           ++s;         } else {           if (a[e - 1] ==  0 )             x =  1 ;           else             x =  0 ;           --e;         }         if (x != b[i]) {           ++count;           ans.push_back(i + 1);         } else {           count += 2;           ans.push_back(1);           ans.push_back(i + 1);         }         flag = 1 - flag;       }       cout << count <<    ;       for (auto it : ans) cout << it <<    ;       cout << endl;     }     return 0;   }   