#include <bits/stdc++.h>
using namespace std;
const int N = 4005;
int cnt1[4], cnt2[4], n, ans[N], flag, T;
char s[N], t[N];
void work(int x) {
  if (x == 0) return;
  ans[++ans[0]] = x;
  reverse(s + 1, s + x + 1);
}
void solve() {
  ans[0] = 0;
  memset(cnt1, 0, sizeof(cnt1));
  memset(cnt2, 0, sizeof(cnt2));
  scanf("%s%s", s + 1, t + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) s[i] &= 1, t[i] &= 1;
  for (int i = 1; i <= n; i += 2) cnt1[s[i] * 2 + s[i + 1]]++;
  for (int i = 1; i <= n; i += 2) cnt2[t[i] * 2 + t[i + 1]]++;
  if (cnt1[0] != cnt2[0] || cnt1[3] != cnt2[3]) {
    puts("-1");
    return;
  }
  int s1 = cnt1[1] - cnt1[2], s2 = cnt2[1] - cnt2[2];
  if (abs(s1) < abs(s2))
    swap(s, t), flag = 1;
  else
    flag = 0;
  if (s1 != -s2)
    for (int i = 1, S = 0; i <= n; i += 2) {
      if (s[i] == 0 && s[i + 1] == 1) S++;
      if (s[i] == 1 && s[i + 1] == 0) S--;
      if (s1 - 2 * S == -s2) {
        work(i + 1);
        break;
      }
    }
  for (int i = 1; i <= n; i += 2)
    for (int j = i; j <= n; j += 2)
      if (s[j + 1] == t[n - i] && s[j] == t[n - i + 1]) {
        work(j - 1);
        work(j + 1);
        break;
      }
  if (flag) reverse(ans + 1, ans + ans[0] + 1);
  printf("%d\n", ans[0]);
  for (int i = 1; i <= ans[0]; i++) printf("%d ", ans[i]);
  puts("");
}
int main() {
  scanf("%d", &T);
  while (T--) solve();
}
