#include <iostream>
#include <algorithm>
#include <cmath>
#include <array>
#define scanf scanf_s
using namespace std;
int main()
{
int t;
int *walls;
int *children;
cin >> t;
while (t--)
{
int n,mxm=0;
cin>>n;
walls = new int[n];
children = new int[n];
for (int i = 0; i < n; i++)
{
cin >> walls[i];
}
for (int i = 0; i < n; i++)
{
cin>>children[i];
if (children[i] > walls[i]) mxm = max(mxm, children[i] - walls[i]);
}
printf("%d\n", mxm);
}
}