t = int(input())
res = []

for i in range(t):
    n = int(input())

    l1 = list(map(int, input().split()))
    l2 = list(map(int, input().split()))
    res.append(n*2-1)

for i in range(t):
    print(res[i])