#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
int c[maxn], id[maxn];
int a[2][maxn];
vector<vector<int>> cnt;
vector<pair<int, int>> g[maxn];
vector<pair<int, int>> pos[maxn];
void dfs(int u, int color, int num) {
  c[u] = color;
  id[u] = num;
  ++cnt[num][color];
  for (pair<int, int>& p : g[u]) {
    if (c[p.first] == -1) {
      dfs(p.first, color ^ p.second, num);
    }
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    fill(pos, pos + n, vector<pair<int, int>>());
    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < n; ++j) {
        scanf("%d", &a[i][j]);
        pos[a[i][j] - 1].emplace_back(i, j);
      }
    }
    bool flag = true;
    fill(g, g + n, vector<pair<int, int>>());
    for (int i = 0; i < n; ++i) {
      if (pos[i].size() != 2) {
        flag = false;
        break;
      }
      int c1 = pos[i][0].second, c2 = pos[i][1].second;
      if (c1 == c2) continue;
      int r1 = pos[i][0].first, r2 = pos[i][1].first;
      g[c1].emplace_back(c2, r1 == r2);
      g[c2].emplace_back(c1, r1 == r2);
    }
    if (flag) {
      cnt.clear();
      fill(c, c + n, -1);
      fill(id, id + n, 0);
      int ans = 0, num = 0;
      for (int i = 0; i < n; ++i) {
        if (c[i] == -1) {
          cnt.emplace_back(2);
          dfs(i, 0, num);
          ans += min(cnt[num][0], cnt[num][1]);
          ++num;
        }
      }
      printf("%d\n", ans);
      for (int i = 0; i < n; ++i) {
        if (c[i] ^ (cnt[id[i]][0] < cnt[id[i]][1])) {
          printf("%d ", i + 1);
        }
      }
      puts("");
    } else {
      puts("-1");
    }
  }
  return 0;
}
