------
## 最终结论
```python
import sys

def read_input():
    input = sys.stdin.read
    data = input().split()
    return data

data = read_input()
index = 0
t = int(data[index])
index += 1

results = []

for _ in range(t):
    n = int(data[index])
    index += 1
    words = data[index:index + n]
    index += n
    
    start_with_0, start_with_1 = set(), set()

    for i, word in enumerate(words):
        if word[0] == '0':
            start_with_0.add((word, i + 1))
        else:
            start_with_1.add((word, i + 1))
    
    count_01, count_10 = 0, 0
    for word, _ in start_with_0:
        if word[-1] == '1':
            count_01 += 1
    for word, _ in start_with_1:
        if word[-1] == '0':
            count_10 += 1
    
    if count_01 > 0 and count_10 > 0:
        if abs(count_01 - count_10) % 2 != 0:
            results.append("-1")
            continue

        to_reverse = set()
        need_to_reverse = abs(count_01 - count_10) // 2

        if count_01 > count_10:
            target_set = start_with_0
            end_char = '1'
        else:
            target_set = start_with_1
            end_char = '0'

        reversed_count = 0

        for word, idx in target_set:
            if reversed_count >= need_to_reverse:
                break
            if word[-1] == end_char:
                to_reverse.add(idx)
                reversed_count += 1

        results.append(f"{len(to_reverse)}")
        if len(to_reverse) > 0:
            results.append(" ".join(map(str, sorted(to_reverse))))
        
    else:
        results.append("0")

sys.stdout.write("\n".join(results) + "\n")
```