t = int(input()) for _ in range(t): n = int(input()) a = [int(x) for x in input().split(" ")] b = [int(x) for x in input().split(" ")] res = max(j - i for i, j in zip(a, b)) print(res if res > 0 else 0)